Home All Groups Group Topic Archive Search About

How to use information from udl file to connect to ODBC Datasource

Author
22 Apr 2006 5:51 PM
JzP
Hi,
I have a vb.net program which accesses a sql database and produces
PowerPoint charts. There are several sqlConnections in the code which
have to be changed if the target database server changes.
Ideally I would like to be able to pass the defined name of an ODBC
connection which has been set up on whatever machine is running the
application so that the program connects to the correct server and
database.
I can get the connection string but it only seems to consist of
something like "Provider=MSDASQL.1;Persist Security Info=False;Data
Source=TestDB".
If I try to use that as a connection with Dim co1 as New
Odbc.OdbcConnection(conString)
the co1.Open statement fails with a "[Microsoft][ODBC Driver Manager]
Data Source name not found and no default driver specified" error.
I assume that there is more information available to complete the
string but can anyone tell me where to find this at run time?

Thanks in advance.

John

AddThis Social Bookmark Button