this.DataGrid1.DataSource = ds.Tables["ps"].DefaultView;看能不能产生正确的XML文档。
打开XML文档看看
有没有“PS”这个结点

解决方案 »

  1.   

    XML文档是没有错误,我在VS.NET中打开过
      

  2.   

    如果在外部引用中没有找到编码,则默认值设置为 UTF-8!
    你写入是用 ("gb2312"),所以读也要用 gb2312
      

  3.   

    FileStream fs = new FileStream(Server.MapPath("province.xml"),FileMode.OpenOrCreate);
    XmlTextWriter xtw = new XmlTextWriter(fs,System.Text.Encoding.GetEncoding("gb2312"));
    ds.WriteXml(xtw,XmlWriteMode.WriteSchema);
    fs.Close();
    替换为
    Ds.WriteXml("myname.xml", XmlWriteMode.WriteSchema)
      

  4.   

    XmlTextWriter xtw = new XmlTextWriter(fs,System.Text.Encoding.GetEncoding("gb2312"));
    xtw.WriteStartDocument()  //或者增加这一行,你的没有书写版本为“1.0”的 XML 声明
    ds.WriteXml(xtw,XmlWriteMode.WriteSchema);
    fs.Close();