protected void Button1_Click(object sender, EventArgs e)
{ if(name.Text == "")
{
strPath = "C://Inetpub//wwwroot//" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xls";
}
else
{
strPath = "C://Inetpub//wwwroot//" + name.Text + ".xls";
}
File1.PostedFile.SaveAs(strPath);
string mystring = "Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = '" + strPath + "';Extended Properties=Excel 8.0";
OleDbConnection cnnxls = new OleDbConnection(mystring);
OleDbDataAdapter myDa = new OleDbDataAdapter("select * from [Sheet1$]", cnnxls);
DataSet myDs = new DataSet();
myDa.Fill(myDs);
GridView2.DataSource = myDs.Tables[0];
GridView2.DataBind(); }
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货