Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copy to Access MDB
Message
De
03/03/2004 16:44:27
Dave Nantais
Light speed database solutions
Ontario, Canada
 
 
À
03/03/2004 16:29:03
Joel Hokanson
Services Integration Group
Bellaire, Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00882905
Message ID:
00882912
Vues:
19
>Is there a reasonable way to copy data from a VFP table to an Access MDB?

I use SQL Passthrough...

first you connect to the Access database this way

lcConnect = "DBQ=" + m.AccessDB + ";" + ;
"DEFAULTDIR=" + m.AccessDir + ";" + ;
"Driver={Microsoft Access Driver (*.mdb)};DriverId=281;" + ;
"FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;"

m.lnConnect = SQLSTRINGCONNECT(lcConnect)

Where m.AccessDB is the full path of the Access database.
m.AccessDir is the directory of the Access database.

m.lnConnect hold the connection handle for the access database..

When m.lnConnect > 0 you have a valid connection to the Access database.

then issue a series of commands to add records to the relavent tables
via
m.result=SQLEXEC(lnConnect,lcQuery)

Where m.lcQuery is the Access MDB command for adding a new record.

The cool thing is that once you've established a connection to the Access MDB you are passing Access SQL commands DIRECTLY via the SQLEXEC command.

Thus, you are using Access/JET SQL language to add records.

then issue

= SQLDISCONNECT(lnConnect) to release the connection with the AccessMDB

good luck
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform