关于“System.Data.OleDb.OleDbException,外部数据库驱动程序 (1) 中的意外错误。”的解决方案
小白浏览:8922018-07-13 20:11:12本文累计收益:0我也要赚钱
背景:
客户在导入格式为xls的excel文件,发生了错误(下面是我用程序重现的错误的信息
未处理System.Data.OleDb.OleDbException HResult=-2147467259 Message=外部数据库驱动程序 (1) 中的意外错误。 Source=Microsoft JET Database Engine ErrorCode=-2147467259 StackTrace: 在 System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) 在 System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) 在 System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) 在 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions) 在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) 在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) 在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) 在 System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) 在 System.Data.OleDb.OleDbConnection.Open() 在 ConsoleApplication1.Program.Main(String[] args) 位置 c:\Users\pliu\Desktop\WebApi\ConsoleApplication1\ConsoleApplication1\Program.cs:行号 25 在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) 在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) 在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 在 System.Threading.ThreadHelper.ThreadStart_Context(Object state) 在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 在 System.Threading.ThreadHelper.ThreadStart() InnerException:
原因:
由于微软在2017-10-10更新了安全补丁(KB4041678KB4041681),两个补丁的更新内容中,都包含有这个更新内容(Security updates to Microsoft Windows Search Component, Windows kernel-mode drivers, Microsoft Graphics Component, Internet Explorer, Windows kernel, Windows Wireless Networking,Microsoft JET Database Engine, and the Windows SMB Server.)。其中我们注意到,由更新了Microsoft JET Database Engine。
在补丁的下面有说此次更新会导致的问题(如下),由此我们可以知道,是这个补丁导致的问题。
Installing this update may cause applications based on theMicrosoft JET Database Engine (Microsoft Access 2007 and older or non-Microsoft applications) to fail whencreating or opening Microsoft Excel .xls files. The error message is, “Unexpected error from external database driver (1). (Microsoft JET Database Engine)".
补丁后续说会及时更新这个问题。
 
解决方案:
1、网上的方案是:在控制面板>程序>程序和功能>已安装更新中,找到对应的两个补丁,进行卸载。不同系统对应不同的补丁,具体可以参考:http://www.cnblogs.com/net-god/p/7661313.html
2、微软给出的解决方案是:下载新的驱动引擎(Microsoft Access Database Engine 2010 Redistributable),更改Provider=Microsoft.Jet.OLEDB.4.0为Provider=Microsoft.ACE.OLEDB.12.0。
第二种试了没成功,第一种方法解决了问题。
 
 
评论列表
发表评论
+ 关注