ado.net through odbc to access

thursday

New member
Joined
Apr 3, 2003
Messages
3
Location
waterloo
Hi,

Im getting the following error:

An unhandled exception of type System.ArgumentException occurred in system.data.dll

Additional information: The .Net Data OLE DB Provider(System.Data.OleDb) does not support the MSDASQL Provider, Microsoft OLE DB Provider for ODBC Drivers.

Heres some code.

Code:
    Dim DataCon As New OleDb.OleDbConnection("Provider=Microsoft OLE DB Provider for ODBC Drivers;DSN=brandlab;HOST=127.0.0.1;UID=;PWD=")
    Dim cmd As New OleDb.OleDbCommand()

What is the correct connection string for an odbc connection to an access database?

Thanks.
 
I did a search on this and it came up with what i wanted.
I send you to the thread but im new at this, so do a search and there ya go.

Hope it helps.

database tutorial for vb.net
 
you dont need provider,host,uid...because you declared all that stuff in ODBC DAtaSource (as i can see -->"DSN=brandlab;")

Dim DataCon As New OleDb.OleDbConnection("DSN=brandlab;") will work fine
 
or you can try with this:

Dim DataCon As New OleDb.OleDbConnection(DRIVER={Microsoft Access Driver(*.mdb)};DBQ=path\yourdatabase;uid=user;pwd=pass)
 
i wanted to stay away from hardcoding the database path into the app. but after some research, i dont think there is a way to use a DSN with OLE DB.

I have it figured out.. but thank you for your help.
 
Back
Top