日期:2014-05-17 浏览次数:20378 次
string conString = file.FileName;
string strSource = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + conString + "; Extended Properties =Excel 8.0";
OleDbConnection conn = new OleDbConnection(strSource);
string sqlstring = @"SELECT * FROM [Sheet1$]";
OleDbDataAdapter adapter = new OleDbDataAdapter(sqlstring, conn);
DataSet da = new DataSet();
adapter.Fill(da);
this.GridView1.DataSource = da.Tables[0];