I’m trying to get data from an centura sqlbase server via ODBC. Connection succeeds, but the result.execute fails.
Here’s (most of) my code:
=======================================
… dim variables …
dataSource = “SOURCENAME”
userName = “USER”
password = “PW”
tabelle = “AMES_1”
sqlstr = “SELECT * FROM AMES_1 WHERE KDNR = ‘00001805’”
On Error Goto errorHandler
con.ConnectTo(dataSource, userName, password)
’ – here I test for table names, they return fine – including AMES_1
’ – so the connection is up, and I can “see” the tables
tables = con.ListTables()
msg = dataSource & " contains the following tables:" & Chr(10)
For n% = Lbound(tables) To Ubound(tables)
msg = msg & Chr(10) & tables(n%)
Next
Messagebox msg, "Tables for " & dataSource
’ === now I try my SQL Query: ===
Set qry.Connection = con
qry.sql = sqlstr
Set result.query = qry
result.Execute ’ ===> but from here it jumps to the errorHandler
…
con.Disconnect
Exit Sub
errorHandler:
…
Messagebox result.GetError
’ – and the error message is: result.GetError = “500”
=======================================
When I debug the code and look into the variables, qry.Connection is empty (doesn’t show any value) – but I think this is normal?
And what sort of result.execute error gives an result.geterror = 500? (as far as I understand the docu: “If an operation is successful, the return number is 500” this number shows that there is no error?!)
Is anything wrong in my sql statement?
Or must this be an error in the ODBC connection (and drivers)?
I can query data with excel from this (sqlbase) server, from the AMES_1 table, of course with the same username/pw.
Thanks for any help in advance
Uwe