标签:
读取Excel中的数据到DataSet
1、引用命名空间
using System.Data.OleDb;
2、输入Excel文件,输出DataSet
public DataSet ExecleDs()
{
string strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\data-for-source-apportionment\\PM-SO2-NOx-CO-O3-201311-20140324.xlsx;Extended Properties=‘Excel 12.0;HDR=YES‘";
OleDbConnection conn = new OleDbConnection(strConn);
OleDbDataAdapter odda = new OleDbDataAdapter("select * from [ConcHourCSV$]", conn);
DataSet ds = new DataSet();
odda.Fill(ds);
return ds;
}
标签:
原文地址:http://www.cnblogs.com/zhangyg/p/4738815.html