尝试与 Excel 建立连接时出现 OleDb 异常



我正在开发一个C#Windows表单应用程序,它可以将数据读取和写入Excel文件,例如数据.xls

我已将连接字符串设置为:

string Excel03ConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='Excel 8.0;HDR=YES'";

我的数据.xls文件位于项目的 bin 文件夹中。我正在处理此应用程序,从最近 4 到 5 天。到目前为止,我的应用程序运行良好。但是从今天开始,它开始给出错误

Unexpected error from external database driver (1).

on con.open();

这似乎是上次Windows更新引入的错误。

若要避免此错误,可以将连接字符串中的提供程序更改为 Microsoft.ACE.OLEDB.12.0 而不是 Microsoft.Jet.OLEDB.4.0

https://blogs.msdn.microsoft.com/dataaccesstechnologies/2017/10/18/unexpected-error-from-external-database-driver-1-microsoft-jet-database-engine-after-applying-october-security-updates/

删除以下知识库以解决此问题
视窗 10 版本 1703 - KB4041676
Windows 10 版本 1607 和 Windows Server 2016 - KB4041691
Windows 8.1 和 Windows Server 2012 - KB4041693
Windows 7 和 Windows Server 2008 R2 - KB4041681
由于 2017 年 10 月第二周的窗口更新

最新更新