【发布时间】:2014-09-26 04:36:36
【问题描述】:
我制作了一个 mvc 应用程序,它将 excel 文件保存在 azure blob blob 存储中。现在我想阅读这个 excel 文件的内容。
之前我将此文件保存在我的 c:/temp 文件夹和批量复制它的代码如下:-
string excelConnectionString = string.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0 Xml;HDR=YES;""", path);
OleDbConnection connection = new OleDbConnection();
connection.ConnectionString = excelConnectionString;
OleDbCommand command = new OleDbCommand("select * from [Sheet1$]", connection);
connection.Open();
DbDataReader dr = command.ExecuteReader();
using (var bulkCopy = new SqlBulkCopy(ConfigurationManager.ConnectionStrings["myString"].ConnectionString, SqlBulkCopyOptions.KeepNulls & SqlBulkCopyOptions.KeepIdentity))
{
//my logic
}
connection.Close();
因为我想在 Azure 云上实施这个解决方案。
现在我将 excel 文件保存到 Azure blobstorage 而不是 c:/temp。 但我无法批量复制它。
请提出建议。
【问题讨论】:
标签: asp.net-mvc azure azure-sql-database azure-storage azure-blob-storage