By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,306 Members | 1,657 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,306 IT Pros & Developers. It's quick & easy.

connecting to access db

P: n/a
I'm working on a Win app and in the Data tab there are only classes for
OleDB and Sql.

I create an OleDB (Using the Microsoft OLE DB Provider for ODBC) connection
to my Access DB, but it throws the following error when I try to actually
drag a table onto the form.

"You cannot use a OLE DB provider for ODBC drivers"

Any ideas on what might be wrong?

Thanks
Rich.
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Kavvy" <r@hfeajhjgg.gt> wrote in message news:19*******************************@40tude.net. ..
I'm working on a Win app and in the Data tab there are only classes for
OleDB and Sql.
From this I'm inferring you're using Visual Studio .NET 2002 and
therefore do not have System.Data.Odbc (added in VS 2003)
available.
I create an OleDB (Using the Microsoft OLE DB Provider for ODBC)
connection to my Access DB, but it throws the following error when I
try to actually drag a table onto the form.

"You cannot use a OLE DB provider for ODBC drivers"

Any ideas on what might be wrong?


This is correct, the OLE DB Provider does not support OLE DB-ODBC
as the underlying driver stack.

Is there any particular reason you must use ODBC? You state that
it's an Access database you are connecting to, if that's a fixed part
of your application's design, why not use the OLE DB Provider for
the native Microsoft Jet driver?

Create an OleDbConnection (et al) as you normally would, and use
this as the connection string (substituting the drive path to your .mdb
file, of course):

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\mydir\myData.mdb;"

That's the vanilla connection string, if you have a user name, password,
file sharing, or other requirements the ConnectionString can grow much
more complex.
Derek Harmon
Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.