C# 让 Microsoft.jet.oledb.4.0 或 microsoft.ace.oledb.12.0 在 64 位 Windows 7 机器上工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9723702/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Getting Microsoft.jet.oledb.4.0 or microsoft.ace.oledb.12.0 to work on 64 bit Windows 7 machine
提问by JTRookie86
I have an application that was built on a Windows XP 32 bit machine. The .exe file of the application has no problem running on XP 32 Bit machines. However; it will not run on a Windows 7 64 bit machine. When I try to run it in Windows 7, I get the following error:
我有一个在 Windows XP 32 位机器上构建的应用程序。该应用程序的 .exe 文件在 XP 32 位机器上运行没有问题。然而; 它不会在 Windows 7 64 位机器上运行。当我尝试在 Windows 7 中运行它时,出现以下错误:
Microsoft.jet.oledb.4.0 provider is not registered on local machine.
Microsoft.jet.oledb.4.0 提供程序未在本地计算机上注册。
I read somewhere that Microsoft.Jet.Oledb.4.0 cannot be used on 32 bit machines. Therefore; I changed the connection string in my config file to have the data provider set to microsoft.ace.oledb.12.0. I published my fies and tried to run it on the Windows 7 machine. I got the following error:
我在某处读到 Microsoft.Jet.Oledb.4.0 不能在 32 位机器上使用。所以; 我更改了配置文件中的连接字符串,将数据提供程序设置为 microsoft.ace.oledb.12.0。我发布了我的 fies 并尝试在 Windows 7 机器上运行它。我收到以下错误:
Microsoft.ace.oledb.12.0 is not registered on the local machine.
Microsoft.ace.oledb.12.0 未在本地机器上注册。
My application was converted from Visual Studio 2005- 2010 and is programmed in c#.
我的应用程序是从 Visual Studio 2005-2010 转换而来的,并且是用 c# 编程的。
Any suggestions?
有什么建议?
Thanks!
谢谢!
采纳答案by Kiran Solkar
100 % working Solution
100% 工作解决方案
When you run your .NET Application – and I know this – on your x64 box, its because Microsoft does not support JET on 64bit versions of Windows outside of Windows 2003.
当你在你的 x64 机器上运行你的 .NET 应用程序时——我知道这一点——这是因为 Microsoft 不支持 Windows 2003 之外的 64 位版本的 Windows 上的 JET。
So, what to do? Simple, you need to make sure that the assembly is written targeting ‘x86′ rather than ‘Any CPU' or ‘x64′ in the Configuration Manager, rebuild the assemblies and you should be good to go :-)
那么该怎么办?很简单,您需要确保在配置管理器中针对“x86”而不是“Any CPU”或“x64”编写程序集,重建程序集,您应该很高兴:-)
回答by Roman R.
Jet DB (MS Access, AKA Microsoft.Jet.OLEDB.4.0) is only available in 32-bit. There is no 64-bit version. You have to target to Win32platform, or switch to another database.
Jet DB(MS Access,AKA Microsoft.Jet.OLEDB.4.0)仅在 32 位可用。没有 64 位版本。您必须以Win32平台为目标,或切换到另一个数据库。
UPD. Appears to be covered by an earlier post: Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine
更新。似乎被较早的帖子覆盖:Microsoft.Jet.OLEDB.4.0' provider 未在本地机器上注册
As for "ACE" you perhaps need an additional driver to be installed:
至于“ACE”,您可能需要安装额外的驱动程序:
回答by Gavin Coates
By default .NET applications are set to run as either 32bit or 64bit applications, depending on the architecture of the operating system detected when running.
默认情况下,.NET 应用程序设置为作为 32 位或 64 位应用程序运行,具体取决于运行时检测到的操作系统架构。
However, Microsoft.Jet.OLEDB.4.0 is not available in 64bit, and cannot be accessed by 64bit applications.
但是,Microsoft.Jet.OLEDB.4.0 在 64 位中不可用,并且无法被 64 位应用程序访问。
The solution, is to set the platform type in Visual Studio to "x86" (32-bit) prior to compiling, that way it will always run as a 32 bit application, even if it is running on a 64 bit operating system.
解决方案是在编译之前将 Visual Studio 中的平台类型设置为“x86”(32 位),这样它就会始终作为 32 位应用程序运行,即使它在 64 位操作系统上运行。

