关于“System.Data.OleDb.OleDbException,外部数据库驱动程序 (1) 中的意外错误。”的解决方案

网站之前运行一直很正常,但有一次用户在导入格式为xls的excel文件,发生了错误,跟踪错误后抛出如下的异常:

错误提示:
未处理System.Data.OleDb.OleDbException HResult=-2147467259 Message=外部数据库驱动程序 (1) 中的意外错误。

 原因:

由于微软在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。 
 
原文地址:https://www.cnblogs.com/yayazi/p/8176112.html