Is it possible in VB6 to specify the data source name of the ODBC during connection rather than identifying the database path? For example, I set up a System DSN for an Access database, with DSN "ABC". I entered the following code in VB6:
Dim dbs As ADODB.Connection
Set dbs = New ADODB.Connection
dbs.Provider = "Microsoft.Jet.OLEDB.4.0"
dbs.Properties("Data Source").Value = "C:\ABC_DB.mdb"
dbs.Open
What I want is to specify the data source name of "ABC" in the properties instead of the database path. My purpose is in case I change the path of my database, I just need to change it in the Control Panel->ODBC. I wouldn't have to change my code in
VB anymore.
Is this possible? How can I do this?
Thanks!