这段代码出了什么问题,为什么它不起作用,请建议我。我上传csv文件在gridview中显示,但是如果循环,控件不会进入。
if (csv_upload.HasFile)
{
string target = Server.MapPath("~/Upload");
lbl_status.Text = "File Uploaded Successfully";
csv_upload.SaveAs(target);
string constring = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Text;",
System.IO.Path.GetDirectoryName(target + "\\" + csv_upload.FileName));
string cmdstring = string.Format("SELECT * FROM 0}",System.IO.Path.GetFileName(target + "\\" + csv_upload.FileName));
OleDbDataAdapter oda = new OleDbDataAdapter(constring,cmdstring);
System.Data.DataSet ds = new System.Data.DataSet();
oda.Fill(ds);
GridView1.DataSource=ds.Tables[0];
GridView1.DataBind();
}