Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0Excel
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
kubi081785
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
Your Filters
Interested
Ignored
     
0 Shai Vashdi 1,518
1 Tadit Dash 350
2 Manas Bhardwaj 319
3 OriginalGriff 243
4 Sergey Alexandrovich Kryukov 240
0 Sergey Alexandrovich Kryukov 9,530
1 OriginalGriff 5,716
2 Peter Leow 4,320
3 Maciej Los 3,540
4 Abhinav S 3,373


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