简体   繁体   English

microsoft.ace.oledb.12.0提供程序未在本地计算机上注册

[英]the microsoft.ace.oledb.12.0 provider is not registered on the local machine

I have the following program in which i want to insert the values in MS-Access.I am getting the error "the microsoft.ace.oledb.12.0 provider is not registered on the local machine" 我有以下程序要在MS-Access中插入值。我收到错误消息“ microsoft.ace.oledb.12.0提供程序未在本地计算机上注册”

I have already installed the database engine as per suggestion of some developers, still i am getting the error. 我已经按照一些开发人员的建议安装了数据库引擎,但仍然出现错误。

I am writing the code on Vista machine with VS-2008 and MS-Access-2007. 我正在使用VS-2008和MS-Access-2007在Vista计算机上编写代码。

Please help me to resolve the error 请帮助我解决错误

public partial class Form1 : Form 公共局部类Form1:表单

{
    public Form1()
    {
        InitializeComponent();
    }
    OleDbConnection con;
    OleDbCommand cmd;
    private void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
             con = new OleDbConnection("Provider=Microsft.ACE.Oledb.12.0;Data Source=C:\\Users\\Satish\\Documents\\Testing.accdb");
            con.Open();
            string cmdText = "Insert Into UserDetail (UsrName,Age,Address,MobileNo) Values ('" + txtName.Text.ToString().Trim() + "','" + txtAge.Text.ToString().Trim() + "','" + txtAddress.Text.ToString().Trim() + "','" + txtMobile.Text.ToString().Trim() + "')";
             cmd = new OleDbCommand(cmdText, con);
            cmd.ExecuteNonQuery();
            con.Close();

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }


    }


}

Try changing the advanced compile configuration to x86. 尝试将高级编译配置更改为x86。 This is usually because you have a 64bit operating system. 这通常是因为您具有64位操作系统。

in VS2008 在VS2008中

Build -> Configuration Manager -> Active Solution Platform: -> New -> Type or select the new platform -> x86 - > OK 构建->配置管理器->活动解决方案平台:->新建->键入或选择新平台-> x86->确定

edit: 编辑:

Try the following: 请尝试以下操作:

go to

C:\Windows\SysWOW64

open odbcad32.exe 打开odbcad32.exe

if you cannot find excel in the list just click on Add and add it 如果您在列表中找不到excel,只需单击“添加”并添加它

You can register you assembly with RegSrv32 您可以使用RegSrv32注册程序RegSrv32

Because you use COM , and COM must be regsitered. 因为使用COM ,所以必须重新注册COM。

Link : http://msdn.microsoft.com/en-us/library/ms859484.aspx 链接: http//msdn.microsoft.com/en-us/library/ms859484.aspx

RegSrv32 permit you to register your COM in register base (microsoft.ace.oledb.12.0 provider) RegSrv32允许您在注册库中注册COM(microsoft.ace.oledb.12.0提供程序)

I have had this problem before when I have deployed an application on a User's machine that has Office 2003 installed rather than Office 2007. It sounds to me like the version of Office on your machine isn't installed correctly. 在将应用程序部署在已安装Office 2003而不是Office 2007的用户计算机上之前,我曾遇到过此问题。听起来像是您计算机上的Office版本未正确安装。

One possible work around is to change your Provider to a previous version like Microsoft.ace.oledb.4.0 and see if the same error persists. 一种可能的解决方法是将您的提供程序更改为以前的版本,例如Microsoft.ace.oledb.4.0,然后查看是否仍然存在相同的错误。

The first thing you need to check is your build configuration of your application. 您需要检查的第一件事是应用程序的构建配置。

  • If you have built your project under x86 platform , then in order to resolve you issue you should install the following packages on your machine: 如果您是在x86平台下构建项目的 ,那么为了解决问题,您应该在计算机上安装以下软件包:

    1. In order to use the 'Microsoft.ACE.OLEDB.12.0' provider you must install the Microsoft Access Database Engine 2010 Redistributable first, this installation is available at: http://www.microsoft.com/download/en/details.aspx?id=13255 . 为了使用“ Microsoft.ACE.OLEDB.12.0”提供程序,必须首先安装Microsoft Access Database Engine 2010可再发行组件 ,此安装位于: http : //www.microsoft.com/download/en/details.aspx ?id = 13255

      After the installation has complete, try running you application, if this solves the issue great, if not, continue to step 2. 安装完成后,请尝试运行您的应用程序,如果这样可以很好地解决问题,请继续执行步骤2。

    2. This next step is an unexplained workaround, which works for Office 2010, even though it is the Data Connectivity Components of Office 2007. I am not quite sure why this works, but it does and this has been proven to work in almost all cases. 下一步是一个无法解释的变通办法,即使它是Office 2007的数据连接组件,也可以在Office 2010中使用。我不太确定为什么这样做,但事实证明它可以工作,并且几乎在所有情况下都可以工作。 You need to install the 2007 Office System Driver: Data Connectivity Components , this installation is available at: http://www.microsoft.com/download/en/confirmation.aspx?id=23734 . 您需要安装2007 Office System驱动程序:数据连接组件 ,该安装位于: http : //www.microsoft.com/download/en/confirmation.aspx?id=23734

      After this installation is complete, try running your application, this should resolve the issue. 安装完成后,请尝试运行您的应用程序,这应该可以解决该问题。

  • If you are trying to run an application built under x64 or AnyCPU platform , I would recommend first validating that it runs as expected under the x86 platform. 如果您尝试运行在x64或AnyCPU平台下构建应用程序 ,我建议您首先验证它是否在x86平台下按预期运行。 In the event that it does not run under that x86 platform, perform the steps in the first part and validate that it runs as expected. 如果它不能在该x86平台上运行,请执行第一部分中的步骤并验证它是否按预期运行。

    I did read that the MS Access drivers including the OLEDB Database driver works only under the x86 platform and is incompatible under the x64 or AnyCPU platform. 我确实读过,包括OLEDB数据库驱动程序在内的MS Access驱动程序仅在x86平台下有效,在x64或AnyCPU平台下不兼容。 But this appears to be untrue. 但这似乎是不正确的。 I validated my application was running when building x86, then I installed the Access Database Engine using the passive flag. 我在构建x86时验证了我的应用程序正在运行,然后使用被动标志安装了Access Database Engine。

    1. First download the file locally You can download the installation here: http://www.microsoft.com/en-us/download/details.aspx?id=13255 首先在本地下载文件您可以在此处下载安装: http : //www.microsoft.com/zh-cn/download/details.aspx?id=13255
    2. Installing using the command prompt with the '/passive' flag. 使用带有“ / passive”标志的命令提示符进行安装。 In the command prompt run the following command: 'AccessDatabaseEngine_x64.exe /passive' 在命令提示符下,运行以下命令:'AccessDatabaseEngine_x64.exe / passive'

    After these 2 steps I managed to run my application after building in x64 or AnyCPU build configuration. 经过这两个步骤,在x64或AnyCPU构建配置中构建后,我设法运行了我的应用程序。 This appeared to solve my issue. 这似乎解决了我的问题。

Note: The order of the steps seems to make a difference, so please follow accordingly. 注意:步骤的顺序似乎有所不同,因此请相应地遵循。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未在本地计算机上注册“ Provider = Microsoft.ACE.OLEDB.12.0”提供程序 - The 'Provider=Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine “'Microsoft.ACE.OLEDB.12.0' 提供程序未在本地计算机上注册” - "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine" 'Microsoft.ACE.OLEDB.12.0' 提供程序未在本地计算机上注册 - The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine “Microsoft.ACE.OLEDB.12.0”提供程序未在本地计算机上注册。 - The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. 'Microsoft.ACE.OLEDB.12.0' 提供程序未在本地计算机(服务器)上注册 - The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine (server) 错误:“ Microsoft.ACE.OLEDB.12.0”提供程序未在本地计算机上注册” - Error: 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine' Microsoft.ACE.OLEDB.12.0提供程序未在本地计算机上注册? - Microsoft.ACE.OLEDB.12.0 Provider is not registered on the Local Machine? microsoft.ace.oledb.12.0 provider未在本地注册 - microsoft.ace.oledb.12.0 provider is not registered on the local machine Azure-'Microsoft.ACE.OleDb.12.0'提供程序未在本地计算机上注册 - Azure - 'Microsoft.ACE.OleDb.12.0' provider is not registered on the local machine Microsoft.ACE.OLEDB.12.0'提供程序未在本地计算机上注册错误 - Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM