Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File ODBC Connection String

Status
Not open for further replies.

Kavius

Programmer
Apr 11, 2002
322
CA
I wrote a program about 3 months ago, just for personal use. All of a sudden, my manager is asking me if I have ever seen a program like this and would know where we could get one (sometimes I love my life). Unfortunately, I wrote my program to connect to an Access2000 DB through the Jet Drivers and my manager needs it for SQL Server.

Rather than hardcoding the fix I would like to store the connection string in a file so that if I start changing DB's a lot, I can just modify the config file. Enter DSN file, that way users can change the connection string as they need to and I never have to look at the code again.

Unfortunately, I don't know how to point an ADO connection to an ODBC "File" (system ODBC no problem). Could someone send me a sample of a valid Connection String for and ODBC File? Or, if you like, tell me I'm going about this the wrong way and suggest something better?

Thnx in advance.
 
After doing a bit of reading I still have a problem.
DSN File:
Code:
[ODBC]
Driver={SQL Server}
Server=sql01
UID=statcreater
PWD=
DATABASE=STATS
Connection Sring:
Code:
cnn.ConnectionString = "FILEDSN=" & App.Path & "\Quotes.dsn;"
I get an error every time it gets to the open method:
Could not find installable ISAM.

Help...
 
Alright...The ODBC error went away but the connection string has changed. I found another example of a connection string that was different and now it works:
Code:
cnn.ConnectionString = _
  "FILE NAME=" & App.Path & "\Stats.dsn"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top