The 'Microsoft.ACE.OLEDB.14.0' provider is

2019-05-23 22:06发布

问题:

I have built a small WPF app that will read in XLS or XLSX files and display the contents in a datagrid. I have the XLS side of things working by using the Microsoft.Jet.OLEDB.4.0 provider. I am struggling with the XLSX side of things. I am running Windows 7 (64-bit) and have Office 2010 (64-bit) installed on my machine. I see the version 14 and 12 versions of the OLEDB in my ODBC connections. When I run my connection string it returns an error. I have read through many of the posts without any successful answers, many pointing to the version the app is running which is x86. I have tried both 14.0 and 12.0 getting the same error with respective version numbers.

Connection String:
Provider=Microsoft.ACE.OLEDB.14.0;Data Source=C:\Users\xxxxx\Desktop\test.xlsx;Extended Properties=\"Excel 14.0;HDR=Yes;IMEX=1\"

Code:

using (OleDbConnection connection = new OleDbConnection(GetConnectionString()))
{
    connection.Open();
}

Error:
The 'Microsoft.ACE.OLEDB.14.0' provider is not registered on the local machine.

回答1:

I was having the same issue. I am using Office 2010 products.

I had to download the Office 2007 Access Database Engine in order to get my app to work.

Download the following:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=7554F536-8C28-4598-9B72-EF94E038C891&displaylang=en



回答2:

From what I've ready trying to deal with this, you can end up with different drivers registered for 32-bit and 64-bit on an x64 machine.

The clearest example I've seen of demonstrating this is searching for ODBC administration from your start menu, and comparing the 32-bit and 64-bit lists when yo ugo to add a new DSN