Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0 Excel
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 6-Sep-12 21:26pm
kubi081841
Edited 6-Sep-12 21:46pm
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Using the same ACE.OleDB works..
  Permalink  
Rate this: bad
good
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[^]
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 6,651
1 Sergey Alexandrovich Kryukov 6,400
2 CPallini 5,230
3 George Jonsson 3,574
4 Gihan Liyanage 2,542


Advertise | Privacy | Mobile
Web02 | 2.8.140921.1 | Last Updated 18 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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