Saturday, April 17, 2010

VB .net avec win7 x64

So here is one thing that may help other people.
I have Win7 x64 and a VB application using Microsoft Access DB. My version of Office is 2007 32 bits.
The VB application is old, and I have to make it works on VS2008. Before it used OLEDB4.0. When I started the program I had this error: provider is not registered on locale machine.

After searching on the Web, I found out that I needed to install new driver (or provider) from Microsoft Website: 2010 Office System Driver Beta: Data Connectivity Components.

And here is what I understood:
  • download 14.0.4536.1000_AccessDatabaseEngine_none_ship_x86_en-us_exe\AccessDatabaseEngine.exe if your Office is 32bits.
  • in the properties of your VB application, go to advanced compile options and choose CPU target: x86
  • in the string connection, use: gDB.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=""MDITMain.mdb"";Persist Security Info=False". Do not use "14.0". This is a bug, you can find more information on google

If you want to test your DB connection, check here: "UDL Test" on a 64 bit machine
Here is what was inside my UDL file:
[oledb]
; Everything after this line is an OLE DB initstring
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\xxx\Documents\Visual Studio 2008\Projects\WindowsApplication1\WindowsApplication1\DBMain.mdb;Persist Security Info=False

That's it for now