Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting Records out of Access Tables
Message
De
03/11/2004 19:52:55
 
 
À
02/11/2004 17:24:08
Gaylen Miller
Leaderware Corporation
Fulton, Illinois, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00954660
Message ID:
00957915
Vues:
12
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform