I am writing Visual Basic code to access a Pervasive 2000 SQL database and want to use the CONCAT, IF, and LEFT functions in SELECT statements. So far, though, I seem to get an empty recordset when I use any of them. I don't get error messages when
VB executes the project, though.
If I go into the Pervasive Control Center and execute the queries from there, they work, but not in my
VB code. If I go into SQL Builder in
VB, it will say the sql code could be 'verified against the data source', but won't run--'data provider or other service returned an E_FAIL status'.
EXAMPLE:
strcnx = "Provider = PervasiveOLEDB;Data Source=StarTracer;Password=<pwd>;User ID=<uid>;Persist Security Info=True"
<this statement works--rs.RecordCount shows records returned>
rs.Open "select lastname AS LName, firstname as FName from people", strcnx, adOpenDynamic, adLockOptimistic, adCmdText
<but this one doesn't--rs.RecordCount is zero, same if I use CONCAT or IF statements>
rs.Open "select left(lastname, 5) AS LName, firstname as FName from people", strcnx, adOpenDynamic, adLockOptimistic, adCmdText
MsgBox rs.RecordCount
MsgBox Err.Number & ", " & Err.Description & ", " & Err.Source