'Microsoft.ACE.OLEDB.12.0' provider is not registered -but it is

六眼飞鱼酱① 提交于 2020-01-05 19:06:13

问题


Short and sweet:

  • app works on x86 machine but not on x64 (tried on a 2008 Server and a Windows 8)
  • Microsoft Access Database Engine 2010 already installed (also have Microsoft Office 2007 Access Database Engine installed)
  • MS Office not installed
  • confirmed the existence of C:\Program Files (x86)\Common Files\microsoft shared\OFFICE12\ACEOLEDB.DLL

Code:

string conn = "Provider=SQLOLEDB;Data Source=localhost;Initial Catalog=Northwind;Integrated Security=SSPI;";
OleDbConnection _connOle = new OleDbConnection(conn);

Any ideas what I should do to get this app to work on the x64 machines? Thanks!


回答1:


I can think of two scenarios that could explain your issue:

  1. Your C# project is set to target both 64-bit and 32-bit platforms and the 64-bit machine has only the 32-bit version of the Access Database Engine installed. The reference fails because the program is running as 64-bit but the machine is missing

    C:\Program Files\Common Files\Microsoft Shared\OFFICE14\ACEOLEDB.DLL

  2. Your C# project is set to target 32-bit platforms only (x86) and the 64-bit machine has only the 64-bit version of the Access Database Engine installed. The reference fails because the program is running as 32-bit but the machine is missing

    C:\Program Files (x86)\Common Files\microsoft shared\OFFICE14\ACEOLEDB.DLL

Note that the installer for the 64-bit version of the Access Database Engine installs just the 64-bit version, not both.




回答2:


Although the question has already been answered, here's what fixed things for me after spending many hours on the problem.

I used Process Monitor to find out what registry key was being looked up. It was HKEY_CLASSES_ROOT\Microsoft.ACE.OLEBD.12.0.

In my case this key was missing despite "Microsoft Access database engine 2010" being listed in Programs and Features.

In addition the file ACEOLEDB.DLL already existed in C:\Program Files\Common Files\Microsoft Shared\OFFICE14\.

Reinstalling "Microsoft Access Database Engine 2010 Redistributable" quit without indicating any error, but Windows Event Log indicated a problem, and looking at the install log file, it appears that there was some version mismatch ("Another version of this product is already installed").
So, I uninstalled "Microsoft Access database engine 2010" from "Program and Features", and then reinstalled it. Now it installed ok.
This resulted in the registry key HKEY_CLASSES_ROOT\Microsoft.ACE.OLEBD.12.0 being added, and my copy of ACEOLDBD.DLL being replaced with an earlier version (14.0.7011.1000 from 14.0.7159.5000).



来源:https://stackoverflow.com/questions/15538774/microsoft-ace-oledb-12-0-provider-is-not-registered-but-it-is

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!