gpt4 book ai didi

c# - 使用 Microsoft.Jet.OLEDB.4.0 连接导入 Excel 表时出错

转载 作者:行者123 更新时间:2023-11-30 18:37:24 25 4
gpt4 key购买 nike

我是asp.net的新手

当我在 IIS 上运行我的 Web 应用程序时出现以下错误,我在 xp-64 位和 window-7 上都尝试了这段代码

 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine. 

当我在“http://localhost:1464/Default.aspx”这样的端口上运行它时,它运行良好

我正在使用下面的代码

OleDbCommand excelCommand = new OleDbCommand();
OleDbDataAdapter excelDataAdapter = new OleDbDataAdapter();
string path = Server.MapPath(filename);
string excelConnStr = "provider=Microsoft.Jet.OLEDB.4.0;data source='" + path + "';Extended Properties='Excel 8.0; HDR=Yes; IMEX=1'";

OleDbConnection excelConn = new OleDbConnection(excelConnStr);
excelConn.Open();

最佳答案

您需要将应用程序池配置为 32 位模式。检查this

关于c# - 使用 Microsoft.Jet.OLEDB.4.0 连接导入 Excel 表时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12853519/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com