Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursoradapter and mdb tables
Message
From
05/11/2004 10:46:19
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00958209
Message ID:
00958509
Views:
17
This message has been marked as a message which has helped to the initial question of the thread.
Hi Bernhart,

Not Cursoradapter but easy...
lcImportFromDir = "C:\AccountingData\"
lcOpenMDB = "Test.mdb"

*-This line creates a connection String to the Access Database
lnConnHandle = SQLSTRINGCONNECT('DSN=MS Access Database;DBQ=' + lcImportFromDir + lcOpenMDB + '; DefaultDir=' + lcImportFromDir + ';DriverId=25;FIL=MS Access; MaxBufferSize=2048; PageTimeout=5; UID=admin;')

*-You can now use 'lnConnHandle' in SQL statements to Access the mdb and do whatever you want.
*-i.e.
*-This line opens a cursor named 'ThisMDB' which contains a record for each Table in the mdb which includes the Table_Name.
SQLTABLES(lnConnHandle, ['TABLE'], 'ThisMDB')

*-The following SCAN opens for editing all tables in the mdb
SELECT ThisMDB
SCAN
 	lcCursor = ALLTRIM(table_name)
 	lcSQL = 'SELECT * FROM "' + ALLTRIM(table_name) + '"'
	lcTableName = LEFTC(lcOpenMDB,(AT(".",lcOpenMDB)-1)) + '^' + lcCursor
	SQLEXEC(lnConnHandle,lcSQL,lcCursor)
	*-Now that this table is open, edit or whatever here, or below the SCAN...
	
ENDSCAN

SQLDISCONNECT(lnConnHandle)
Thanks
Gaylen Miller
Previous
Reply
Map
View

Click here to load this message in the networking platform