protected void Button1_Click(object sender, EventArgs e)
{
string strConn;
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=D://123.xls;" + "Extended Properties=Excel 8.0;";
OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [sheet1$]", strConn);
DataSet myDataSet = new DataSet();
myCommand.Fill(myDataSet, "ExcelInfo");
GridView1.DataSource = myDataSet.Tables["ExcelInfo"].DefaultView;
GridView1.DataBind();
}
Excel导入
最新推荐文章于 2024-08-31 09:43:30 发布