简体   繁体   中英

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

两种文件都应使用ACE.OleDB。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM