Click to See Complete Forum and Search --> : ODBC routines! Please Help!!
clarkgriswald
Feb 2nd, 2000, 09:54 PM
I am creating an application that can save, open, create any kind of ODBC database using ADO. My question is, what method would I use to create a database...remember one routine hase to be able to create Access, Excel, FoxPro, etc...Please help this is a time-critical piece..Thanks!
JHausmann
Feb 3rd, 2000, 02:02 AM
I suspect you're going to have to roll your own. The connection object requires the datasource to be present and you can't do much in ADO without a connection.
Still, I am new to ADO...
clarkgriswald
Feb 3rd, 2000, 02:14 AM
Well, I DO have the Provider, the DSN, and database name...it is just that for example:
if mydb.xls(excel) does not exist then
Set ado_connection = New ADODB.Connection
ado_connection.Open connect_string
...will create the xls file....
BUT
if mydb.mdb(access) does not exist then
Set ado_connection = New ADODB.Connection
ado_connection.Open connect_string
fails!!!
This is why I need a UNIVERSAL routine..
Thanks!
JHausmann
Feb 4th, 2000, 02:49 AM
It's going to depend on the OLE DB Provider and how it's written to deal with non-existent sources. If SQL Server sources don't exist, for example, the Provider isn't going to have enough information to create a database.
Excel is, more or less, a flat data file. The Excel provider doesn't need special information to make the file.
Best you can do is trap for the error and tell your user the datasource isn't present (if you don't want to write your own creation routines).
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.