xml文件读取后绑定到gridview
更新:HHH   时间:2023-1-7


  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>");
            }

返回编程语言教程...