[英]'Microsoft.ACE.OLEDB.12.0' provider is not registered -but it is
Short and sweet: 短而甜蜜:
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? 有什么想法让我的应用程序在x64机器上运行? Thanks!
谢谢!
I can think of two scenarios that could explain your issue: 我可以想到两个可以解释您的问题的方案:
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. 您的C#项目设置为针对64位和32位平台,而64位计算机仅安装了32位版本的Access数据库引擎。 The reference fails because the program is running as 64-bit but the machine is missing
引用失败,因为程序以64位运行但机器丢失
C:\\Program Files\\Common Files\\Microsoft Shared\\OFFICE14\\ACEOLEDB.DLL C:\\ Program Files \\ Common Files \\ Microsoft Shared \\ OFFICE14 \\ ACEOLEDB.DLL
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. 您的C#项目设置为仅针对32位平台(x86),而64位计算机仅安装了64位版本的Access数据库引擎。 The reference fails because the program is running as 32-bit but the machine is missing
引用失败,因为程序以32位运行但机器丢失
C:\\Program Files (x86)\\Common Files\\microsoft shared\\OFFICE14\\ACEOLEDB.DLL 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. 请注意,64位版本的Access数据库引擎的安装程序仅安装64位版本,而不是两者。
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. 我使用Process Monitor来查找正在查找的注册表项。 It was
HKEY_CLASSES_ROOT\\Microsoft.ACE.OLEBD.12.0
. 它是
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. 在我的情况下,尽管“程序和功能”中列出了“Microsoft Access数据库引擎2010”,但此密钥仍然丢失。
In addition the file ACEOLEDB.DLL
already existed in C:\\Program Files\\Common Files\\Microsoft Shared\\OFFICE14\\
. 此外,文件
ACEOLEDB.DLL
已存在于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"). 重新安装“Microsoft Access数据库引擎2010可再发行组件”退出而不指示任何错误,但Windows事件日志指示存在问题,并查看安装日志文件,似乎有一些版本不匹配(“已安装此产品的另一个版本” )。
So, I uninstalled "Microsoft Access database engine 2010" from "Program and Features", and then reinstalled it. 因此,我从“程序和功能”中卸载了“Microsoft Access数据库引擎2010”,然后重新安装它。 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). 这导致添加了注册表项
HKEY_CLASSES_ROOT\\Microsoft.ACE.OLEBD.12.0
,并且我的ACEOLDBD.DLL
副本被替换为早期版本(14.0.7011.1000从14.0.7159.5000)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.