本文共 435 字,大约阅读时间需要 1 分钟。
DataSet ds = new DataSet();
string filePath = FileUpload1.PostedFile.FileName.ToString(); try { if (filePath == " ") { Response.Write("<script language='javascript'>alert('文件路径不能为空!')</script>"); } else { ds.ReadXml(filePath); gvPersonList.DataSource = ds.Tables[0]; gvPersonList.DataBind(); } } catch(Exception) { Response.Write("<script language='javascript'>alert('导入不正确!')</script>"); } 转载于:https://blog.51cto.com/cuijinfeng/940065