繁体   English   中英

未在本地计算机上注册“ Provider = Microsoft.ACE.OLEDB.12.0”提供程序

[英]The 'Provider=Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine

我已经尝试了所有操作,从定位x86,下载AccessDatabaseEngine,Microsoft Access Database Engine 2010 Redistributable,转到“工具”->“选项”->“项目和解决方案”->“ Web项目”,然后取消选中“将IIS Express的64位版本用于网站和项目”。 我卸载了我拥有的每个Office应用程序。 我下载了32位Office 2013,因此拥有Access 2013,Visual Studio Express 2015 for Web。

我有Test.accdb数据库,所以我必须连接槽OleDbConnection。

这是我代码中相关的部分。 打开连接后,我得到了一些东西,但是没关系,因为它甚至没有到达那里:

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;

namespace FirstTest
{
    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            OleDbConnection connection = new OleDbConnection();
            connection.ConnectionString = @"Provider=Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\MyUser\Desktop\FirstTest\App_Data\Test.accdb;Persist Security Info=True;";

            connection.Open();

            OleDbCommand command = new OleDbCommand();
            command.Connection = connection;


        }
    }
}

构建项目后,出现“ connection.Open()”错误。

奇怪的是,如果我转到“服务器资源管理器”,请右键单击数据库,然后单击“刷新”,它将在其上放一些绿色。 每次构建时,它都会变成红色。

我有W10 64位。 这是一次获得求职面试的测试,任务确实很简单,但是由于无法连接数据库,因此我无法测试到目前为止所做的工作。

您有两次Provider= ,应该只出现一次。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM