Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Export a Table To an Access Database?
Message
From
15/01/2001 11:59:16
 
 
To
15/01/2001 10:35:06
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00463763
Message ID:
00463817
Views:
22
Dave,

There are different ways to do this. The following code uses SQL-passthrough:

*-- build connection string
lcConnectionStr = "DRIVER={Microsoft Access Driver (*.mdb)};" +;
"Dbq=c:\temp\bidon.mdb;" +;
"Uid=Admin;" +;
"Pwd=;"

*-- connect to MS Access
lnAccess = SQLSTRINGCONNECT(lcConnectionStr)

*-- create the table
*-- Note that we need to use Access SQL dialect (char(12) vs. C(12))
SQLEXEC(lnAccess, "CREATE TABLE test (Type char(12), id char(12))")

*-- select some data
SELECT type, id FROM HOME()+"foxuser" INTO CURSOR test

*-- insert the result set into MS Access
WAIT WINDOW NOWAIT "Inserting data into MS Access..."
SCAN
SQLEXEC(lnAccess, "INSERT INTO test VALUES('" + Type + "', '"+id+"')")
ENDSCAN
Daniel
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform