>Hi All,
>
>I am attempting to connect to an Access database.
>
>I use lnConnHandle=sqlstringconnect('DSN=MS Access Database;DBQ='+;
> lcMDBDir+'\'+lcMDBName+';DefaultDir='+;
> lcMDBDir+';DriverId=25;FIL=MS Access;MaxBufferSize=2048;'+;
> 'PageTimeout=5;UID=admin;')
>
>after setting the lc variables to their proper values and make a successful connection.
>
>I follow this with...
>
> sqltables(lnConnHandle,['TABLE'], 'curMDB')
>
>...to retrieve a cursor that contains the names of the tables within the Database.
>
>In this instance there is only one table, therefore, one record in curMDB.
>
>I then build the following variables:
>
> lcSQL='select * from '+trim(table_name)
> lcCursor='curAccTbl'
>
>I then issue...
>
> nresult=sqlexec(lnConnHandle,lcSQL,lcCursor)
>
>...in order to get to the actual table, but it fails, returning a value of -1 in nresult.
>
>What have I missed?
>
>Thanks
What AERROR said?
Try this, and tell me:
lcSQL = 'select * from [' + ALLTRIM(table_name) + ']'
lcCursor = 'curAccTbl'
nresult = sqlexec(lnConnHandle,lcSQL,lcCursor)
IF nresult < 0
AERROR(laErr)
MessageBox(laErr[1,2])
ENDIF
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.