I've asked this question in below link. Reposting this with the new error message that I'm facing:
Exception in Importing excel using C# using Oledbconnection
I'm trying to build "Import to DB from excel" functionality.
I use the below connection string which works fine locally
excelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path +
";Extended Properties=\"HDR=YES;\";Jet OLEDB:Engine Type=37";
After deployment, i get Error :System.InvalidOperationException: The 'Microsoft.Jet.OLEDB.12.0' provider is not registered on the local machine.
Steps Taken as suggested in first post:
- Changed the Platform Target from 'Any CPU' to x86 in both Configuration Manager --> Platform & Project --> Properties --> Build. After doing this I get 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 32 bit. The deployment IIS server is 64 bit.
- Again changed from x86 to 64 bit in both the places mentioned in above point & deployed. Got the original error "System.InvalidOperationException: The 'Microsoft.Jet.OLEDB.12.0' provider is not registered on the local machine."
I googled for BadImageFormatException but couldn't find much. I cannot install ACE or any other excel components in IIS.
Please let me know if there is any solution to this.