Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to load xls and xlsx file in c#. For xls I'm using:
C#
Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=;Extended Properties=\"Excel 8.0;HDR=YES\ 

For xlsx :
C#
Provider=Microsoft.Ace.OLEDB.12.0;
Data Source=;
Extended Properties=\"Excel 12.0;HDR=YES\ 

once the projects platform target was Any Cpu I can upload xlsx file without problem but when I upload xls file I got the following error:
HTML
"The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine."

And if I change the Platform Target to x86 then xls file is uploaded without problem but this time xlsx file is giving this error:
HTML
"The 'Microsoft.Ace.OLEDB.12.0' provider is not registered on the local machine."

How can I upload but file formats without error?

Thanks
Posted
Updated 6-Sep-12 21:46pm
v3

Using the same ACE.OleDB works..
 
Share this answer
 
JET Supports only 32 bit.

Xls with ACE Driver:
CSS
Provider=Microsoft.Ace.OLEDB.12.0;
 Data Source=;
 Extended Properties=\"Excel 8.0;HDR=YES\"


XLSX with ACE Driver:

CSS
Provider=Microsoft.Ace.OLEDB.12.0;
 Data Source=;
 Extended Properties=\"Excel 12.0;HDR=YES\"



And also make build to Specific x86 for your app. Do not use Any CPU. I have faced issues on 64 bit OS when Office 12.0 ACE driver used.

You may also try latest driver:

http://www.microsoft.com/en-us/download/details.aspx?id=13255[^]
 
Share this answer
 

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