获取“microsoft.ace.oledb.12.0”提供程序未在本地计算机上注册错误 [英] Getting the 'microsoft.ace.oledb.12.0' provider is not registered on the local machine error
问题描述
嗨专家,
我收到'Microsoft.ACE.OLEDB.12.0'提供程序未在本地计算机上注册。使用文件上载控件导入Excel工作表时出错。我需要在我的数据库中插入excel数据。我正在使用visual studio 2013版本。但我正在使用Windows 2008 R2服务器。当我在我的本地运行代码工作正常。但是,当我通过服务器运行代码时,我遇到了错误。我尝试在应用程序池提前设置中启用32位应用程序= true。此外,我尝试安装 [ 2007 Office System驱动程序:数据连接组件],但我仍然遇到同样的错误。任何人都可以建议我如何解决它吗?
这是我的代码
我尝试过:
Hi Experts,
I am getting "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine." Error when i import the excel sheet using file upload control. I need to insert excel data in my database. I am using visual studio 2013 version. But i am using Windows 2008 R2 server. When i run code in my local its working fine. But when i run code through server i am getting above error. I tried to "enable 32-bit applications = true" in application pool advance settings. Also i tried to install [2007 Office System Driver: Data Connectivity Components] but still i am getting same error. Can any one suggest me how to fix it?
Here is my code
What I have tried:
<pre>ArrayList CategoryList = new ArrayList();
menuupload.SaveAs(Server.MapPath(menuupload.FileName));
string fileName = menuupload.ResolveClientUrl(menuupload.PostedFile.FileName);
DataTable dtExcel = new DataTable();
string SourceConstr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath(fileName) + ";Extended Properties= 'Excel 8.0;HDR=Yes;IMEX=1'";
OleDbConnection con = new OleDbConnection(SourceConstr);
string query = "Select * from [Items$]";
OleDbDataAdapter data = new OleDbDataAdapter(query, con);
data.Fill(dtExcel);
推荐答案
;
OleDbDataAdapter data = new OleDbDataAdapter(query,con );
data.Fill(dtExcel);
"; OleDbDataAdapter data = new OleDbDataAdapter(query, con); data.Fill(dtExcel);
您必须在服务器上安装Access Runtime。从其中 [ ^ ]。
如果您的应用已编译x86,并在32位或64位服务器上运行,您必须安装32位运行时。
如果您的应用程序是编译AnyCPU,并且正在运行在32位服务器上,您必须安装32位运行时。
如果您的应用程序是编译AnyCPU,并在64位服务器上运行,那么必须安装64位运行时。
如果您的应用程序是编译x64,它必须在64位运行rver,你必须安装64位运行时。
You have to install the Access Runtime on the server. Get it from here[^].
If your app is compiled x86, and running on a 32-bit or 64-bit server, you have to install the 32-bit runtime.
If your app is compiled AnyCPU, and running on a 32-bit server, you have to install the 32-bit runtime.
If your app is compiled AnyCPU, and running on a 64-bit server, you have to install the 64-bit runtime.
If your app is compiled x64, it must run on a 64-bit server, and you have to install the 64-bit runtime.
这篇关于获取“microsoft.ace.oledb.12.0”提供程序未在本地计算机上注册错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!