.net 在哪里/如何下载(和安装)适用于 Windows 8、64 位的 Microsoft.Jet.OLEDB.4.0?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13811179/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 16:47:20  来源:igfitidea点击:

Where/how can I download (and install) the Microsoft.Jet.OLEDB.4.0 for Windows 8, 64 bit?

.netwindows-8

提问by Clay Nichols

I've got a 32 bit .net 2.0 app that uses the Jet OLEDB 4.0.

我有一个使用 Jet OLEDB 4.0 的 32 位 .net 2.0 应用程序。

It runs fin on Windows 8 32 bit, but not on the 64 bit. on 64 bit I'm getting an error:

它在 Windows 8 32 位上运行 fin,但不在 64 位上运行。在 64 位上,我收到一个错误:

'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine. at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)

“Microsoft.Jet.OLEDB.4.0”提供程序未在本地计算机上注册。在 System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)

I am aware that you can't use that database (driver) with a 64bit EXE. However I've not read anything about it not working with the 32bit exe.

我知道您不能在64位 EXE 中使用该数据库(驱动程序)。但是我没有读到任何关于它不能与32位 exe一起工作的内容。

What I tried:

我试过的:

  1. Installed the MS Access Database Engine 2010 32 bit (and restarted)
  2. Verified that msjet40.dll is in the "C:\Windows\SysWOW64\msjet40.dll" directory and registered it with RegSvr32.
  1. 安装了 MS Access Database Engine 2010 32 位(并重新启动)
  2. 验证 msjet40.dll 位于“C:\Windows\SysWOW64\msjet40.dll”目录中,并使用 RegSvr32 注册。

So I think(hope) that if I can install the database support it'll just work.

所以我认为(希望)如果我可以安装数据库支持,它就会起作用。

Problem is, I can't find any place to download it.

问题是,我找不到任何下载它的地方。

回答by fvu

On modern Windows this driver isn't available by default anymore, but you can download as Microsoft Access Database Engine 2010 Redistributableon the MS site. If your app is 32 bits be sure to download and install the 32 bits variant because to my knowledge the 32 and 64 bit variant cannot coexist.

在现代 Windows 上,默认情况下此驱动程序不再可用,但您可以在 MS 站点上下载为Microsoft Access Database Engine 2010 Redistributable。如果您的应用程序是 32 位,请务必下载并安装 32 位变体,因为据我所知,32 位和 64 位变体不能共存。

Depending on how your app locates its db driver, that might be all that's needed. However, if you use an UDL file there's one extra step - you need to edit that file. Unfortunately, on a 64bits machine the wizard used to edit UDL files is 64 bits by default, it won't see the JET driver and just slap whatever driver it finds first in the UDL file. There are 2 ways to solve this issue:

根据您的应用程序如何定位其 db 驱动程序,这可能就是所需要的。但是,如果您使用 UDL 文件,还有一个额外的步骤 - 您需要编辑该文件。不幸的是,在 64 位机器上,默认情况下用于编辑 UDL 文件的向导是 64 位,它不会看到 JET 驱动程序,而只是拍打它在 UDL 文件中首先找到的任何驱动程序。有两种方法可以解决这个问题:

  1. start the 32 bits UDL wizard like this: C:\Windows\syswow64\rundll32.exe "C:\Program Files (x86)\Common Files\System\Ole DB\oledb32.dll",OpenDSLFile C:\path\to\your.udl. Note that I could use this technique on a Win7 64 Pro, but it didn't work on a Server 2008R2 (could be my mistake, just mentioning)
  2. open the UDL file in Notepad or another text editor, it should more or less have this format:
  1. 开始的32个位UDL向导这样的:C:\Windows\syswow64\rundll32.exe "C:\Program Files (x86)\Common Files\System\Ole DB\oledb32.dll",OpenDSLFile C:\path\to\your.udl。请注意,我可以在 Win7 64 Pro 上使用此技术,但它在 Server 2008R2 上不起作用(可能是我的错误,只是提及)
  2. 在记事本或其他文本编辑器中打开 UDL 文件,它或多或少应该具有以下格式:

[oledb] ; Everything after this line is an OLE DB initstring Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Path\To\The\database.mdb;Persist Security Info=False

[oledb] ; Everything after this line is an OLE DB initstring Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Path\To\The\database.mdb;Persist Security Info=False

That should allow your app to start correctly.

这应该允许您的应用程序正确启动。

回答by Kyle Blake

Make sure to target x86 on your project in Visual Studio. This should fix your trouble.

确保在 Visual Studio 中的项目上以 x86 为目标。这应该可以解决您的问题。