2

There is a discussion on this Diagnosing an OLEDB exception when Quering Excel 2010

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?

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";

Error :System.InvalidOperationException: The 'Microsoft.Jet.OLEDB.12.0' provider is not registered on the local machine.

2 Answers 2

1

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"
Sign up to request clarification or add additional context in comments.

2 Comments

You can set the properties as Sudhakar mentioned above. You can also refer similar answer here stackoverflow.com/questions/11179905/…
I ran into another error, when I changed from 'ANY CPU' to X86. Error: System.BadImageFormatException: Could not load file or assembly 'Webtool' or one of its dependencies. An attempt was made to load a program with an incorrect format. My local machine where i'm developing is in 32 bit. The deployment IIS server is on 64 bit. When I change to 64 bit i get the same error "System.InvalidOperationException: The 'Microsoft.Jet.OLEDB.12.0' provider is not registered on the local machine."
0

I would suggest you take a look at http://linqtocsv.codeplex.com/.

Using this method you can read in your excel files into C# objects, validate them and then submit them to the SQL Database.

The problem your getting above is a tricky one, I've came across this myself in the past, it normally means you require an instance of Microsoft Office of a particular version installing.

We had some users operating on Office 2003 and they couldn't use our system as they required a later version of the Microsoft Jet Engine on there machine.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.