Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting to ACCDB format MS-ACCESS database through OLEDB

I've recently made another question about connecting to MS-ACCESS database with .NET in C# or VB.NET. It worked just as intended with MDB, but with accdb it caused an exception in

conn.Open();

which follows:

alt text http://dl.dropbox.com/u/3045472/accdb_fail.png

Is there another way to do this? My original intention (like stated in the original question) is gathering some (actually, a lot of) fields.

like image 325
Marcelo Avatar asked Mar 03 '10 17:03

Marcelo


People also ask

Can't connect to data source the Microsoft ACE Oledb 12.0 provider is not registered on the local machine?

OLEDB. 12.0' provider is not registered on the local machine." message if you try to connect to Office data like Excel or Access or SQL Server via OLEDB. That's because no 64-Bit MDAC driver is installed by default.

Which driver engine can we use to connect to a Microsoft Access database file?

If you plan on converting the project to be a 64-bit process, it's recommended that you use the 64-bit Microsoft Access Database Engine, also called Access Connectivity Engine (ACE).


1 Answers

Use ACE 4 driver, download it here then use following connection string:

"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\marcelo.accdb;Jet OLEDB:Database Password=MyDbPassword;"

like image 71
Andrey Avatar answered Oct 03 '22 18:10

Andrey