kubilay bayraktar
kubilay bayraktar

Reputation: 101

c# xls and xlsx file import

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

Upvotes: 2

Views: 2322

Answers (1)

Steve
Steve

Reputation: 216293

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

Upvotes: 4

Related Questions