Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords:
The sample code works up to the point of the qExecDirect call. No matter how I've modified the code it always returns a -1.
Has anyone used the ODBC Extender to access a MS Access database?
The format of "statement" will depend on the data source and driver.
SQL Return Codes Constant Meaning Value @qError SQL_ERROR -1You may have to look at MS Access docs, and check your SQL syntax.
NB: Many users can share a database, but the methodology is actually that of sharing files. To enable users to share a database, all the applications that use the database must have access to the database files. Also, none of the applications can open the database in exclusive mode. When you open a database in exclusive mode, you prevent other applications from using the database.
To get further details on why the qExecDirect function might not be working, add:
retcode=qError(hstmt,2)plugging the statement handle into qError... this should return some error message info back from the driver, giving us some insight as to why qExecDirect is failing.
;****************************************** ;Insert Debug(1) retcode = qExecDirect(hstmt, "INSERT INTO %mytable% (%mycolumn%) VALUES ('string')") If (retcode != @qSuccess) && (retcode != @qSuccessInfo) Message("qExecDirect failed", retcode) err=qerror(hstmt,2) message("",err) Exit Endif ;*****************************************
My understanding is that the ODBC extender creates a result set table when qExecDirect() (or one of the related ODBC meta functions) is called.
The problem I had was if you have a set of values stored in WIL variables and you want to insert these into a table using SQL Insert then there has to be a mechanism to bind the variables to columns in a result set before making the qExecDirect call. If you don't have access to a result set before qExecDirect then how do you do the binding?
Run the qBindCol on the variables and columns in question. Then set the variables how you like them and to do the Table Insert operation.
The qBindCol functions are referenced and are used to set the columns from the WIL variables.
Article ID: W12541
Filename: qExecDirect and SQL Questions.txt
File Created: 2001:09:06:11:10:30
Last Updated: 2001:09:06:11:10:30