Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi to all,

I have created a form, in which I want to upload a excel file to save data from the file. I have use 'Microsoft.ACE.OLEDB.12.0' Provider.
It work fine on local machine, but when I published same on web, it won't work.
It gives error as:

'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

Use code is as follows:
C#
DataTable dtExcel = new DataTable();
string SourceConstr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + filename + "';Extended Properties= 'Excel 8.0;HDR=Yes;IMEX=1'";
OleDbConnection con = new OleDbConnection(SourceConstr);
Query = "Select * from [Sheet1$]";
OleDbDataAdapter data = new OleDbDataAdapter(Query, con);
data.Fill(dtExcel);

Please advice is expected.
Thank You
Posted
Comments
[no name] 4-Aug-12 7:17am    
Is Excel installed on the server computer?
Harshad-HBK 4-Aug-12 7:24am    
yes
[no name] 4-Aug-12 7:26am    
https://www.google.com/search?q=+%27Microsoft.ACE.OLEDB.12.0%27+provider+is+not+registered+on+the+local+machine&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

There are two possible problems with your code. What if the other person dosent have an english Excel version, then Sheet wont exist.

The other problem could be this:
http://social.msdn.microsoft.com/Forums/nn-NO/exceldev/thread/0f03c2de-3ee2-475f-b6a2-f4efb97de302[^]
 
Share this answer
 
Comments
Harshad-HBK 7-Aug-12 3:40am    
thanks a lot...
in addition to whats been already said and as an alternative to uploading files, you can copy and paste excel data into a text-box in ASP.NET application and then just parse it out, based on delimiters, to a collection. This collection can then be looped over and pushed to the database. Some of the business bulk-import and upload systems that I have written, were written this way. Always works!
 
Share this answer
 
Comments
Harshad-HBK 7-Aug-12 3:41am    
thanks a lot...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900