在'Microsoft.ACE.OLEDB.12.0'供应商未注册在本地计算机上,同时将数据导出到MS Access [英] The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine while data export to MS ACCESS

查看:254
本文介绍了在'Microsoft.ACE.OLEDB.12.0'供应商未注册在本地计算机上,同时将数据导出到MS Access的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是初学者使用Microsft.ACE.OLEDB 12.0。我创建了一个WinForms应用程序VS 2010。

I am beginner in using Microsft.ACE.OLEDB 12.0. I create a Winforms application VS 2010.

和创建数据导出网格数据到MS Access文件中的函数。我使用的是Microsoft OLEDB

And create a function for export data grid data to MS Access file. I using Microsoft Oledb

有关出口数据网格数据到MS Access file.But我得到这个错误,当我尝试导出

for export the data grid data to MS Access file.But i get this error when i try to export

数据到MS Access。

data to ms access.

请参阅下面的图片。

我也请参阅我的应用程序在 Microsoft.Office 12.0对象库

I also refer the Microsoft.Office 12.0 Object Library in my application.

批量构建配置

请帮助。

推荐答案

接入互操作位的参考无关与你的异常和访问互操作是没有必要的使用类中的 System.Data.OleDb

The reference to the Access Interop bits has nothing to do with your exception and Access Interop is not necessary to use the classes in the System.Data.OleDb.

当你有你的应用程序编译为值为anycpu平台,则是在64位系统和安装ADO.NET提供程序上运行(微软ACE.OLEDB.12.0问题出现)是32位版本。

The problem arises when you have your application compiled for AnyCPU Platform, you are running on a 64bit system and the installed ADO.NET provider (Microsoft ACE.OLEDB.12.0) is the 32bit version.

在使用code会于64位系统和32位系统的32位code 64 code被执行值为anycpu 目标平台。作为64位不能使用32位驱动程序(反之亦然)执行的应用程序。现在加进来了Microsoft.ACE.OLEDB.12.0有两个不同版本的事实。一个用于64位和一个用于32位和在同一台机器上它们不能被安装在一起。

When using the AnyCpu target Platform your code will be executed as 64bit code on 64bit systems and as 32bit code on 32bit systems. An application executed as 64bit cannot use 32bit drivers (and viceversa). Now add to the mix the fact that Microsoft.ACE.OLEDB.12.0 has two different versions. One for 64bit and and one for 32bit and they cannot be installed together on the same machine.

最简单的解决方法是通过Visual Studio菜单更改应用程序的目标平台。

The simplest workaround is to change the Target Platform of your application through Visual Studio menu

 BUILD -> Configuration Manager -> Active Solution Platform -> x86

如果在 86 选项已不存在,然后选择新建,将其命名为 86 从值为anycpu复制设置和检查创建新项目的平台

If the x86 option is not already there, then select NEW, name it x86, Copy Settings from AnyCPU and check Create new project platforms

如果你认为使用一个64位操作系统的32位应用程序是要避免再三思,读<一个性能什么的损失href=\"http://blogs.msdn.com/b/rmbyers/archive/2009/06/09/anycpu-exes-are-usually-more-trouble-then-they-re-worth.aspx\">this参考其中PRO和值为anycpu的缺点是严格审查。如果没有特别原因需要使用值为anycpu 这是更好地留在 86

If you think that using a 32bit app on a 64bit Operating System is a loss of performance or something to be avoided then think twice and read this reference where the PRO and CONS of AnyCpu are critically examined. If you don't have a specific reason to use AnyCpu it is better to stay with x86.

当然,另一种选择是卸载32位版本并安装ACE的从这里,然后运行作为64位系统值为anycpu应用。但是,这可能是您的部署方案的噩梦。如果微软的Office 32位版本安装在x64的目标机器上怎么办?办公室安装ACE其位兼容的版本,正如所说,这是不可能有32位和安装在同一台机器上的ACE 64位。结果
现在你也应该问你的客户重新安装Office为64位,让您的64位应用程序开心。

Of course, another option is to deinstall the 32bit version and install the 64bit version of ACE from here and then run you application as AnyCpu on 64bit systems. But this could be a nightmare for your deployment scenarios. What if Microsoft Office 32bit version is installed on your x64 target machine? Office installs its bit compatible version of ACE and, as said, it is not possible to have 32bit and 64bit of ACE installed on the same machine.
Now you should also ask your customer to reinstall Office as 64bit to keep your 64bit app happy.

更新

结果
这种情况已经改变了一点与Visual Studio的最新版本。现在有一个新的选择是对新项目的默认。这就是所谓的值为anycpu preFER 32位模式即可。在此链接的更多细节:<一href=\"http://blogs.microsoft.co.il/sasha/2012/04/04/what-anycpu-really-means-as-of-net-45-and-visual-studio-11/\">What值为anycpu实际上意味着作为.NET 4.5和Visual Studio 11 以及另一个有趣的帖子(尽管有关的SQL Server Compact)就是这其中的与任何CPU- preFER麻烦的32位BadImageFormatException

UPDATE


The situation has changed a bit with the newest versions of Visual Studio. There is now a new option that is the default for new projects. It is called AnyCPU Prefer 32bit mode. More details at this link: What AnyCPU Really Means As Of .NET 4.5 and Visual Studio 11 and another interesting post (albeit regarding Sql Server Compact) is this one The trouble with Any CPU–Prefer 32 bit–BadImageFormatException

这篇关于在'Microsoft.ACE.OLEDB.12.0'供应商未注册在本地计算机上,同时将数据导出到MS Access的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆