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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using ODBC DSN with .NET 1

Status
Not open for further replies.

pokasick

Programmer
Oct 29, 2001
17
US
Is it possible to use an ODBC DSN with a VB.NET/ADO.NET program? I get an error when trying to use a DSN that we use with our VB.old/ado programs. The database is an SQLServer database. Here is the error: Expected '=' delimiter while parsing connection value pair.

Thanks,
Paul
 

Yes it is possible but without seeing an example of code its hard to tell where you are getting your error and why.

Good Luck

 
Thanks for replying. Here's a method that I put together just to keep all of the related code together to make it easier to read. If I use the connection string that I created using a SQLConnection object, it works just fine. The connection string is stored in an INI file.

Any ideas? Thanks,
Paul


Public Sub GetID()
Dim SQLConnection As New SqlClient.SqlConnection()
Dim SQLConnectionString As String

SQLConnectionString = "LocalServer"

'The error occurs trying to assign the DSN name to the
'ConnectionString property
SQLConnection.ConnectionString = SQLConnectionString
SQLConnection.Open()

'other code...

SQLConnection.Close()

End Sub
 
try this connection string
conSTR = "data source=SERVERNAME ;initial catalog=DBNAME;persist security info=False; packet size=10000;uid=USERNAME;pwd=PASSWORD"


ok

 
You have to have ODBC.Net installed. It doesn't come with Visual Studio .Net. I think it will come with 2003. You can download it at MSDN.

You will use an ODBC connection instead of an SqlConnection.
 
Thanks! I didn't know that there was an ODBC.Net. Do you know of any issues with this being installed on a Win2000 machine running VB6 apps with an older version of ODBC?

Thanks again,
Paul
 
Thanks, I'll look into installing it.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top