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.
我已经构建了一个小的WPF应用程序,可以在XLS或XLSX文件中读取,并在datagrid中显示内容。通过使用Microsoft.Jet.OLEDB.4.0提供程序,我有XLS这方面的工作。我正在与XLSX方面的事情做斗争。我正在运行Windows 7(64位),并在我的机器上安装了Office 2010(64位)。我在我的ODBC连接中看到了OLEDB的版本14和12。当我运行连接字符串时,它会返回一个错误。我读过很多帖子,但没有找到任何成功的答案,很多人都指向这个应用正在运行的x86版本。我已经尝试了14.0和12.0在各自的版本号上获得相同的错误。
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\"
连接字符串:Provider= microsoft.ac . oledb .14.0;数据源=C:\用户xxxxx\桌面\测试.xlsx;
Code:
代码:
using (OleDbConnection connection = new OleDbConnection(GetConnectionString()))
{
connection.Open();
}
Error:
The 'Microsoft.ACE.OLEDB.14.0' provider is not registered on the local machine.
错误:“microsoft.ac . oledb .14.0”提供程序没有在本地机器上注册。
2 个解决方案
#1
0
I was having the same issue. I am using Office 2010 products.
我也有同样的问题。我正在使用Office 2010产品。
I had to download the Office 2007 Access Database Engine in order to get my app to work.
我必须下载Office 2007 Access数据库引擎,才能让我的应用程序正常工作。
Download the following:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=7554F536-8C28-4598-9B72-EF94E038C891&displaylang=en
下载以下:http://www.microsoft.com/downloads/en/details.aspx?familyid=7554f536 - 8 c28 - 4598 - 9 - b72 ef94e038c891&displaylang=en
#2
0
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.
根据我准备处理的内容,您可以在x64计算机上为32位和64位注册不同的驱动程序。
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
我所见过的最清晰的示例是在开始菜单中搜索ODBC管理,并在yo ugo添加新DSN时比较32位和64位列表
#1
0
I was having the same issue. I am using Office 2010 products.
我也有同样的问题。我正在使用Office 2010产品。
I had to download the Office 2007 Access Database Engine in order to get my app to work.
我必须下载Office 2007 Access数据库引擎,才能让我的应用程序正常工作。
Download the following:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=7554F536-8C28-4598-9B72-EF94E038C891&displaylang=en
下载以下:http://www.microsoft.com/downloads/en/details.aspx?familyid=7554f536 - 8 c28 - 4598 - 9 - b72 ef94e038c891&displaylang=en
#2
0
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.
根据我准备处理的内容,您可以在x64计算机上为32位和64位注册不同的驱动程序。
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
我所见过的最清晰的示例是在开始菜单中搜索ODBC管理,并在yo ugo添加新DSN时比较32位和64位列表