Click here to Skip to main content
14,297,742 members
Rate this:
Please Sign up or sign in to vote.
See more:
I want to load xls and xlsx file in c#. For xls I'm using:
Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=;Extended Properties=\"Excel 8.0;HDR=YES\ 

For xlsx :
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:
"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:
"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
Rate this:
Please Sign up or sign in to vote.

Solution 1

Using the same ACE.OleDB works..
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

JET Supports only 32 bit.

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


XLSX with ACE Driver:

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[^]
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100