2
votes

I have an application in vb.net in visual studio 2008.

In my old computer, vista 32 bit system with Microsoft Office 2007 i was able to connect to the access database (mdb file)

Now i bought a new computer which has windows 7 64bit.

I installed my Microsoft Office 2007 (The same i had in previous computer) and Visual Studio 2008.

Problem is now that i cannot connect to the mdb from my application and i get a A first chance exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll

I installed Access Database Engine for Microsoft Office 2007 but it didnt fixed it. When i tried to install Access Database Enginge for Microsoft Office 2010, the x64 version it said it cannot install because i have a 32bit Office in my system.

I know, the first suggestion is to uninstall Microsoft Office 2007 and install the 2010, but is there any other option? I dont wish to use 2010, only if is absolute neccesary.

Important note: If i compile my application and then run it in my old computer (or other 32 bit systems) it runs perfectly so its not a coding problem. Just a library 32/64 bit problem.

3

3 Answers

2
votes

Finding a download for the x64 version of just the ACE provider is indeed impossible afaict. This seems intentional. Select your EXE project in the Solution Explorer window. Project + Properties, Compile tab, scroll down, Advanced Compile Options. Change Target CPU to "x86".

You always want that setting when you debug code, it enables Edit + Continue on a 64-bit machine and avoids a few 64-bit specific hairs. And keep that setting for the Release build when you have a dependency on any 32-bit unmanaged code, like you do in this case.

0
votes

try exporting your database to Microsoft Access 2007 format (*.accdb). Then, change your connection string to:

oleDbConnection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Path + ";";

Hope it helps.