我已经在excel中创建了一个出勤表,我想在gridview中显示所有表格,例如班级出勤报告,学生出勤报告等,有人可以帮我吗?
List<string> excelName = new List<string>();
DataSet ds = new DataSet();
foreach(var name in excelName )
{
using (SqlConnection con = new SqlConnection(connectionString))
{
DataTable dt = new DataTable();
string query ="select * from '"+name+"'";
con.Open();
SqlDataAdapter da = new OleDbDataAdapter(query, con);
da.Fill(dt);
con.Close();
ds.add(dt);
}
}
gridview.DataSource = ds;
gridview.DataBind();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.