admin管理员组文章数量:1317904
• Error : System.InvalidOperationException: 'The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.'
• Description : I tried to read an excel file using asp web application.
Sql connection strings are as follows,
if (Path.GetExtension(filePath) == ".xls")
{
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source {0};Extended Properties='Excel 8.0;HDR=YES;IMEX=1'";
}
else if (Path.GetExtension(filePath) == ".xlsx")
{
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source {0};Extended Properties='Excel 8.0;HDR=YES;IMEX=1'";
}
connectionString = string.Format(connectionString, filePath);
when open the connection, mentioned error ocurred.
Already installed,
• microsoft odbc driver 17 for sql server(17.10.6.1)
• Microsoft ole db driver for sql server(18.7.4.0)
Tried .xls and .xlsx both extentions.
• Error : System.InvalidOperationException: 'The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.'
• Description : I tried to read an excel file using asp web application.
Sql connection strings are as follows,
if (Path.GetExtension(filePath) == ".xls")
{
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source {0};Extended Properties='Excel 8.0;HDR=YES;IMEX=1'";
}
else if (Path.GetExtension(filePath) == ".xlsx")
{
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source {0};Extended Properties='Excel 8.0;HDR=YES;IMEX=1'";
}
connectionString = string.Format(connectionString, filePath);
when open the connection, mentioned error ocurred.
Already installed,
• microsoft odbc driver 17 for sql server(17.10.6.1)
• Microsoft ole db driver for sql server(18.7.4.0)
Tried .xls and .xlsx both extentions.
Share Improve this question edited Feb 13 at 20:21 Dalija Prasnikar♦ 28.6k46 gold badges94 silver badges175 bronze badges asked Jan 23 at 5:14 LahiruKalutotageLahiruKalutotage 11 silver badge2 bronze badges 3- As stated below you shouldnot use the Jet version, it is no longer supported. The ACE engine (32 or 64 bit) supports all Excel file formats, so that is the only one you need. Also, exactly where did you install it? – OldBoy Commented Jan 23 at 9:53
- The following may be of interest: Microsoft OLE DB Provider for Jet and Jet ODBC driver are available in 32-bit versions only – It all makes cents Commented Jan 23 at 17:26
- The following may be of interest: stackoverflow/a/77950023/10024425 – It all makes cents Commented Jan 23 at 17:29
2 Answers
Reset to default 1The JET OLEDB engine is 32bit only, and I do not think it is supported anymore. The replacement is the ACE engine. You need to install the 32/64 bit version depending on the platform of your application. The ACE driver should be bundled with the office package, but I'm unsure if it is bundled in the SQL server driver.
The download page explicitly mentions that the ACE driver support .xls files, so there should be no need to load different drivers depending on file type.
I would also consider replacing the OLEDB driver entirely with a third party library that uses pure managed code. That way you do not have to worry about 32/64 bit issues or having to install a redistributable package etc. There seem to be several libraries available, see https://softwarerecs.stackexchange/ if you want recommendations.
Please check which version of drivers you have installed(X64 or x86). If you have installed 32 bit(x86) version of drivers you have to be sure that you are forcing your application to run on x86 CPU in build configuration. Any CPU will by default run on 64 bit mode and if you have installed 32 bit version of drivers it will not work.
Same applies vice versa. If you have installed 64 bit version of drivers and you are running your app in x86 CPU build configuration it will not work either.
本文标签: c39The 39MicrosoftJetOLEDB4039 provider is not registered on the local machine39Stack Overflow
版权声明:本文标题:c# - 'The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.' - Stack Ov 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742030103a2416286.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论