码迷,mamicode.com
首页 > Web开发 > 详细

Excel .net读取

时间:2015-06-11 18:23:40      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:

public void LoadData(string StyleSheet)
{
string strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" + Server.MapPath
("\\Content\\Excel\\数据填报模版_地产V2.01.xls") + ";Extended Properties=Excel 8.0";
string strExcel = "";
OleDbDataAdapter myCommand = null;
DataSet myDataSet = new DataSet();
string[] tables = { "[填写说明$]", "[经营信息$]", "[职位信息$]", "[入离职信息$]", "[内部异动信息$]", "[薪酬福利信息$]", "[招聘信息(成本)$]", "[招聘信息(执行)$]", "[培训信息$]" };
for (int i = 0; i < tables.Length; i++)
{
strExcel = "select * from "+tables[i];
myCommand = new OleDbDataAdapter(strExcel, strCon);
myCommand.Fill(myDataSet,tables[i]);
}
for (int i = 0; i < myDataSet.Tables.Count; i++)
{
DataTable table = myDataSet.Tables[i];
}
}

Excel .net读取

标签:

原文地址:http://www.cnblogs.com/jinhaoObject/p/4569429.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!