Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADO/ADOX and Access tables
Message
From
29/04/2002 13:27:42
 
 
To
29/04/2002 04:08:24
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00650178
Message ID:
00650489
Views:
16
Thanks!
I have not looked into the OpenSchema() before. I think I stick to the ADO way to do things. What I really it trying to do is to make a COM server to
1. Create a Access database or MS-SQL database
2. Fill it with tables, keys, autonum fields, create indexes,..
3. Move data from DBF tables
4. Update tables when needed
Perhaps somebody has a set of classes to do this?



>Einar,
>Here are two different approaches you could use. The first one uses ADO and OpenSchema(). The second uses SPT and SQLTABLES().
>
>
>*-- using ADO
>#DEFINE adSchemaTables 20
>oConnection = CreateObject("adodb.connection")
>oConnection.Open("DRIVER={Microsoft Access Driver (*.mdb)};" +;
>                 "Dbq=d:\vfpApps\northwind.mdb;" +;
>                 "Uid=Admin;" +;
>                 "Pwd=;")
>oRS = oconnection.OpenSchema(adSchemaTables )
>oRs.Find("table_name = 'customers'")
>llFound = IIF(oRS.EOF, .f., .t.)
>
>
>*-- using SPT
>
>*-- build connection string
>lcConnectionStr = "DRIVER={Microsoft Access Driver (*.mdb)};" +;
>                  "Dbq=d:\vfpApps\northwind.mdb;" +;
>                  "Uid=Admin;" +;
>                  "Pwd=;"
>*-- connect to MDB
>lnSql = SQLSTRINGCONNECT(lcConnectionStr)
>*-- get tables of MDB into cursor
>SQLTABLES(lnSql, "TABLE")
>*-- check if table exists
>LOCATE FOR UPPER(table_name)="CUSTOMERS"
>IF FOUND()
>  *-- table exists
>ELSE
>  *-- table doesn't exist
>ENDIF
>
>
>>What is the best way to test for existence of a table in a Access database?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform