x64 Application Accessing mdb database

喜你入骨 提交于 2019-12-03 20:07:40

You need to use the newest driver from Microsoft called ACE
Here you can find the download bits

Pay attention to download the correct set (x64 or x86) for your intended target machine Also the connection string should make use of these drivers, so you probably need a connection string like this

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=yourPathToTheMDBFile.mdb;
Persist Security Info=False;

As an alternative you could build your application for x86 platform and, if you don't have any direct interaction with 64bit code, it will works as is in the 64bit operating system. This solution is preferable because you could use the old JET.OleDb.4.0

Let me give a brief explanation of the problem with 64/32bit operating system, Platform used to build applications and 32/64bit drivers:

  • You build your application for AnyCPU platform - Your code works fine in 32/64 bit systems, the code emitted by the JIT compiler will have the same bitness of the guest OS. BUT, you could not use 32bit drivers by 64bit apps and viceversa. JET.OleDB.4.0 is 32bit only. End of game if you compile for AnyCPU and run on 64bit. You need a 64bit driver.
  • You build your application for x86 platform - Your code works fine in 32/64 bit systems, and you can use 32bit drivers. Of course the code emitted by the JIT compiler is 32bit and thus you cannot use 64bit drivers on 64bit systems.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!