简体   繁体   中英

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

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!

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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM