office交流网--QQ交流群号

Access培训群:792054000         Excel免费交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

最近经常出现的与Excel导入莫名出错的解决办法

2017-10-30 08:26:00
zstmtony
原创
15341

最近更新过微软windows一些最新补丁的电脑(2017年10月10日开始),凡是使用Excel Driver(驱动)导入或读取Excel文件的VBA代码都会出现以下错误:

基本上都是跟OLEDB有关,导致很多导入Excel的功能(如一些ERP软件,或Excel Access的 VBA相关功能)都会出错:

影响非常多的电脑和软件,在这个月中,我们是接近10多个客户都出现类似的问题:


[ODBC Excel Driver] Reserved error (-5016); there is no message for this error. ERROR [01000] [Microsoft][ODBC Excel Driver]General Warning Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x1644 Thread 0x3e70 DBC 0x4c51fc4 Excel'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed ERROR [01000] [Microsoft][ODBC Excel Driver]General Warning Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x1644 Thread 0x3e70 DBC 0x4c51fc4 Excel'. ERROR [HY000] [Microsoft][ODBC Excel Driver] Reserved error (-5016); there is no message for this error.

Unexpected error from external database driver (1).

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.Data.OleDb.OleDbException: Unexpected error from external database driver (1).

Source Error:


Line 415:        strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties='Excel 8.0;HDR=NO;IMEX=1;'";
Line 416:        OleDbConnection conn = new OleDbConnection(strConn);
Line 417:        conn.Open();
Line 418:        DataTable sheetNames = conn.GetOleDbSchemaTable
Line 419:        (System.Data.OleDb.OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });



经过查找各种资料,发现是


windows  最近更新了一个补丁KB4041681 导致odbc相关操作全部失效 卸载这个补丁就恢复正常了


发现问题原因是由于微软补丁更新了jet4.0的组件导致,具体补丁列表如下:

Win7 SP1更新微软KB4041678、KB4041681(10月汇总包)补丁;
WindowsServer 2008 R2更新微软KB4041678、KB4041681(10月汇总包)补丁;
Win10更新微软KB4041676、KB4041691(10月汇总包)补丁;
WindowsServer 2016更新微软KB4041691(10月汇总包)补丁;
Win8.1更新微软KB4041693补丁;
WindowsServer 2012 R2更新微软KB4041693补丁。



微软暂时也没有更好的办法,现在的处理方法,最好是卸载


微软官方的说明


此更新中的已知问题



症状 解决方法
安装 KB4041681 后,更新包用户在关闭某些应用时可能会看到表明产生应用异常的错误对话。 这个问题会影响到使用 mshtml.dll 加载网站内容的应用。 该问题仅在进程已经关闭的情况下才会发生,不会影响到应用的功能。 Microsoft 正寻求一种解决方案,并会在即将发布的版本中提供更新。

安装此更新后,可能会导致基于 Microsoft JET 数据库引擎(Microsoft Access 2007 和更低版本或非 Microsoft 应用程序)的应用程序无法创建或打开 Microsoft Excel .xls 文件。 错误消息为“外部数据库驱动程序 (1) 中的意外错误。 (Microsoft JET 数据库引擎)。”

下载并安装 Microsoft Access 数据库引擎 2010 可再发行软件包,然后在 Microsoft Excel 中修改 DB 连接字符串以将 ACE 用作提供程序。 示例: 将 Provider=Microsoft.Jet.OLEDB.4.0 更改为 Provider=Microsoft.ACE.OLEDB.12.0。

Microsoft 正寻求一种解决方案,并会在即将发布的版本中提供更新。






其它相关资料:



微软最近更新KB4041681 KB4041678这两个补丁 导致excel导入出问题。卸载之后就好了。如果在程序上修改 如何修改我是用的 这种导入方式OleDbCommand cmdImport =
微软最近更新KB4041681 KB4041678这两个补丁 导致excel导入出问题。 
卸载之后就好了。 
如果在程序上修改 如何修改 

我是用的 这种导入方式 

OleDbCommand cmdImport = new OleDbCommand(sSql, new OleDbConnection(ConnStr));

OleDbDataAdapter adpImport = new OleDbDataAdapter(cmdImport);

DataSet dsImport = new DataSet();
    分享