[英]The 'Provider=Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine
I've tried everything from targeting x86, downloading AccessDatabaseEngine, Microsoft Access Database Engine 2010 Redistributable, going to Tools->Options->Projects and Solutions->Web Projects and unchecking 'Use the 64 bit version of IIS Express for web sites and projects'. 我已经尝试了所有操作,从定位x86,下载AccessDatabaseEngine,Microsoft Access Database Engine 2010 Redistributable,转到“工具”->“选项”->“项目和解决方案”->“ Web项目”,然后取消选中“将IIS Express的64位版本用于网站和项目”。 I uninstalled every Office app I had.
我卸载了我拥有的每个Office应用程序。 I downloaded Office 2013 32-bit so I have Access 2013, Visual Studio Express 2015 for Web.
我下载了32位Office 2013,因此拥有Access 2013,Visual Studio Express 2015 for Web。
I have Test.accdb database so I have to connect trough OleDbConnection. 我有Test.accdb数据库,所以我必须连接槽OleDbConnection。
Here is the part of my code that is relevant. 这是我代码中相关的部分。 I've got something after I open the connection but it doesn't matter because it doesn't even get there:
打开连接后,我得到了一些东西,但是没关系,因为它甚至没有到达那里:
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;
}
}
}
After I build the project I get an error on 'connection.Open()'. 构建项目后,出现“ connection.Open()”错误。
The weird thing is if I go to Server Explorer, right click on my DB and I click on Refresh it puts something green over it. 奇怪的是,如果我转到“服务器资源管理器”,请右键单击数据库,然后单击“刷新”,它将在其上放一些绿色。 And every time I build it gets a red thing.
每次构建时,它都会变成红色。
I have W10 64 bits. 我有W10 64位。 This is a test to get a job interview, the task is really easy but I can't test what I've done so far because I can't connect to the database.
这是一次获得求职面试的测试,任务确实很简单,但是由于无法连接数据库,因此我无法测试到目前为止所做的工作。
您有两次Provider=
,应该只出现一次。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.