Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connection to MS Access
Message
From
02/11/2005 15:32:07
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01064680
Message ID:
01064705
Views:
19
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform