Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting Records out of Access Tables
Message
From
03/11/2004 19:52:55
 
 
To
02/11/2004 17:24:08
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00954660
Message ID:
00957915
Views:
11
Hey,

This is something like I was thinking of except only using Automation to cycle through the tables and a CursorAdapter to get the data. It seems that your code would provide a better performing solution though.

Sorry I really didn't have time to put much effort into it.

Aloha,

James

>Hi James,
>
>As it turns out Automation is not the best way of extracting tables from Microsoft Access.
>
>Here is the code I ended up with:
>
>
>lcImportFromDir = "C:\TEST_MDB\"
>lcExportToDir = "C:\TEST_DBF\"
>
>lcOpenMDB = (SYS(2000,(lcImportFromDir + ("*.mdb"))))
>DO WHILE ! EMPTY(lcOpenMDB )
>	lcExportTableName = LEFTC(lcOpenMDB,(AT(".",lcOpenMDB)-1))
>	lnConnHandle = SQLSTRINGCONNECT('DSN=MS Access Database;DBQ=' + lcImportFromDir + lcOpenMDB + '; DefaultDir=' + lcImportFromDir + ';DriverId=25;FIL=MS Access; MaxBufferSize=2048; PageTimeout=5; UID=admin;')
>	SQLTABLES(lnConnHandle, ['TABLE'], 'ThisMDB')
>	SELECT ThisMDB
>	SCAN
>	  lcSQL = 'SELECT * FROM "' + ALLTRIM(table_name) + '"'
>	  lcCursor = ALLTRIM(table_name)
>	  lcTableName = LEFTC(lcOpenMDB,(AT(".",lcOpenMDB)-1)) + '^' + lcCursor
>	  SQLEXEC(lnConnHandle,lcSQL,lcCursor)
>	  SELECT (lcCursor)
>	  COPY TO (lcExportToDir + lcTableName)
>	  USE IN (lcCursor)
>	ENDSCAN
>	USE IN ThisMDB
>	SQLDISCONNECT(lnConnHandle)
>	lcOpenMDB = (SYS(2000,(lcImportFromDir + ("*.mdb")),1))
>ENDDO
>
>
>Thanks
>Gaylen Miller
Previous
Reply
Map
View

Click here to load this message in the networking platform