参考http://stackoverflow.com/questions/1991643/microsoft-jet-oledb-4-0-provider-is-not-registered-on-the-local-machine第一种解决方法是把程序编译成X86的,因为Microsoft.Jet.OLEDB.4.0 driver不兼容64位操作系统
第二种是下载Microsoft Access 2010 数据库引擎可再发行程序包http://www.microsoft.com/zh-CN/download/details.aspx?id=13255,然后把Provider从"Provider=Microsoft.Jet.OLEDB.4.0"改为"Provider=Microsoft.ACE.OLEDB.12.0;"希望这个能解决你的问题

解决方案 »

  1.   

    非常感谢save4me!!
    第一种方法我试过了,可以。
    第二种方法我试过了,还是提示错误:未處理的例外狀況: System.InvalidOperationException: 'Microsoft.ACE.OLEDB.12.0'提供者並未登錄於本機電腦上。我查了一下,那个程序包已经安装成功了。
      

  2.   

    估计还是32位与64位的问题,我安装“Microsoft Access 2010 数据库引擎可再发行程序包”只能安装32位的,安装64位的提示Office是32位的,所以不能安装。
      

  3.   

    应用程序池-》名称-》右键属性-》常规-》启用32应用程序-》设置为True,就可以 了。
      

  4.   


    噢,我的程序是WinForm程序,不是网站。
    但还是很感谢。
      

  5.   

    以前遇到过类似的问题。08R2只有64位的,也搞不定Access连接,后来一怒之下启用了Hyper-V,装了个32位虚拟机跑应用
      

  6.   

    我先用了Microsoft.Jet.OLEDB.4.0;的可以正常访问的。
    系统和软件:Windows 8.1 x64,MS Access 2013 x64
    IDE用的是SharpDevelop 4.4,你如果用VS这个应该都一样的。注意一下截图编译选项那里看看你是不是一样设置了。
    private const string connstr2 = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=J:\MSAccess.mdb";
    private void GetData(string strConn, string strSQL)
    {
    using (OleDbConnection conn = new OleDbConnection(strConn))
    {
    try
    {
    OleDbCommand cmd = new OleDbCommand(strSQL, conn);
    conn.Open(); OleDbDataReader reader = cmd.ExecuteReader(); if (reader.HasRows)
    {
    while (reader.Read())
    {
    System.Diagnostics.Debug.Print(
    "{0}\t{1}\t{2}",
    reader.GetInt32(0).ToString(),
    reader.GetString(1),
    reader.GetDateTime(2).ToString()
    );
    }
    }
    else
    {
    System.Diagnostics.Debug.Print("No rows found.");
    }
    reader.Close();
    }
    catch (Exception ex)
    {
    //Console.WriteLine(ex.Message);
    }
    // The connection is automatically closed when the
    // code exits the using block.
    }
    }