首页 > Web开发 > 详细

Excel .net读取

时间:2015-06-11 18:22:36      阅读:177      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!