您的位置:首页 > 其它

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

2011-04-08 09:02 483 查看
专案中,需要实现用户上传Excel文件,很久之前,只实现过Excel97-2003版本的文件,现在考虑到用户有可能上传Excel2007或更高版本,两个版本连接有点不一样,可以参考http://www.cnblogs.com/insus/articles/2008946.html 使用.xlsx版本边接语句之后,在run程序时,即出现如下Error:

Server Error in '/WebSite1' Application.

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

Source Error:

Line 21:
Line 22:

Line 23: objDa.Fill(objDs);
Line 24:         this.GridView1.DataSource = objDs.Tables[0];
Line 25:         this.GridView1.DataBind();

Source File: d:\Projects\WebSite1\A.aspx.cs Line: 23

Stack Trace:

[InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.]
System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper) +1027372
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +337
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +86
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +31
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +76
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126
System.Data.OleDb.OleDbConnection.Open() +43
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +123
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +319
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +94
A.Page_Load(Object sender, EventArgs e) in d:\Projects\WebSite1\A.aspx.cs:23
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

原因与解决办法,是因为web服务器没有安装 2007 Office System Driver: Data Connectivity Components ,这个组件有x86与x64版本,您可以根据实际情况选择性下载来安装。

下载连接:http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c06b8369-60dd-4b64-a44b-84b371ede16d
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐