问题描述
有关此
但我的问题是,如果我们不允许在托管网站的IIS服务器中安装ACE组件;我们怎么能避免这个错误?有没有其他方法可以将Excel导入SQL数据库?
But my question is, if we are not allowed to install ACE components in IIS servers where website is hosted; how we can avoid this error? Is there any other way to Import excel to SQL database?
我正在使用下面的连接字符串,并且在部署后在本地但非IIS服务器中工作得很好。
I'm using below connectionstring and works perfectly fine in local but not in IIS server after deployment.
excelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path +
";Extended Properties=\"HDR=YES;\";Jet OLEDB:Engine Type=37";
错误:System.InvalidOperationException:'Microsoft.Jet.OLEDB。 12.0'提供程序未在本地计算机上注册。
Error :System.InvalidOperationException: The 'Microsoft.Jet.OLEDB.12.0' provider is not registered on the local machine.
推荐答案
这是因为您正在将应用程序编译为X64位,请强制它使用以下设置以32位(x86)运行:
it is because you are compiling your application as X64 bit , please force it to run as 32 bit (x86) using following settings:
->Right click on Project
->Select Properties
->Goto Build Options
->Change "Platform Target" from "ANY CPU" to "X86"
这篇关于使用Oledbconnection使用C#导入excel时出现异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!