2
votes

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

1
Have you tried to use the same ACE.OleDB for both types of files?Steve
This is great! It really works, Thank you so much Steve.kubilay bayraktar
Well, glad to be of help, reposted the answer so you could accept it. FAQ-How Accept Answers WorksSteve

1 Answers

4
votes

You should use ACE.OleDB for both types of files.