读取Excel文件,并在C#中的数据库插入记录 - Windows Azure的 [英] Read excel file and insert records in database in C#- Windows Azure
问题描述
我的应用程序的要求是浏览Excel文件,上传文件,从Excel文件读取每一行并插入到数据库中。
The requirements for my application is to browse for an excel file, Upload the file , read each row from the excel file and insert into the database.
我建立在Windows Azure中该应用程序。
在此之前,我已经成功地使用 OleDbDataAdapter的
来读取Excel中的数据文件中的集
。
I am building this application in Windows Azure.
Prior to this I have successfully used OleDbDataAdapter
to read the data from the excel file into the dataset
.
我使用的连接字符串是:
The connection strings I used are:
有关XLS文件:
connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strNewPath & ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=2"""
有关XLSX文件:
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strNewPath & ";Extended Properties=""Excel 12.0;HDR=Yes;IMEX=2"""
请问以下提供 Microsoft.Jet.OLEDB.4.0
&安培; Microsoft.ACE.OLEDB.12.0
Windows Azure中是avaialable?
将接近也是云计算工作,以及这是访问在C#中的Excel文件的最佳方式?
Will the following providers Microsoft.Jet.OLEDB.4.0
& Microsoft.ACE.OLEDB.12.0
be avaialable in Windows Azure?
Will approach also work in Cloud as well and is this the best way to access Excel files in c#?
任何新的想法和建议,欢迎。
Any new ideas and suggestions are welcome.
推荐答案
没有,OLE供应商将不会默认辅助角色下可用。这可能是以后可能让他们在不同的虚拟机的设置虽然。
No, OLE providers will not be available under the Worker Role by default. It might be possible to have them later in a different VM setup though.
有关暂且你基本上仅限于.NET的选项:
For the time being you are basically restricted to .NET-only options:
- EPPlus for XLSX
- NPOI for XLS
这篇关于读取Excel文件,并在C#中的数据库插入记录 - Windows Azure的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!