Connection String for .MDB

  • Thread starter Thread starter jayuya
  • Start date Start date
J

jayuya

Can anyone point me to a link or give me a sample for a
connection string using DSN=??

Do I need to install ODBC for .NET???

this is the one that I normally use in my development
computer

Const ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Database\myApp.mdb;User ID=???;Password=????;"

But my hosting will setup a DSN and i have not done it
that way in my sample application...

Thanks,
jayuya
 
¤ Can anyone point me to a link or give me a sample for a
¤ connection string using DSN=??
¤
¤ Do I need to install ODBC for .NET???
¤
¤ this is the one that I normally use in my development
¤ computer
¤
¤ Const ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
¤ Source=C:\Database\myApp.mdb;User ID=???;Password=????;"
¤
¤ But my hosting will setup a DSN and i have not done it
¤ that way in my sample application...


If you absolutely need to use a DSN then you will need the ODBC .NET managed provider:

HOW TO: Use the ODBC .NET Managed Provider in Visual Basic .NET and Connection Strings
http://support.microsoft.com/default.aspx?scid=kb;en-us;310985

However, using a DSN means using ODBC and you may encounter problems using ODBC and Jet. Using the
OLEDB .NET managed provider is the preferred method:

Dim ConnectionString As String

ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=e:\My Documents\db1.mdb"
Dim AccessConn As New System.Data.OleDb.OleDbConnection(ConnectionString)
AccessConn.Open()


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top