生成dataset的XML文件需要一定的格式,要包含dataset的架构信息,包括字段定义等等,你用一个dataset的XML比较一下看看。

解决方案 »

  1.   

    DataSet ds1 = doc.InnerXml;
                   InnerXml是string啊,你怎么赋值给了DataSet
      

  2.   

    参考ms-help://MS.NETFrameworkSDKv1.1/cptools/html/cpconxmlschemadefinitiontoolxsdexe.htm
    把你需要的XML转换成一个类,然后用它给dataset赋值
      

  3.   

    you can doXmlNode node = doc.SelectSingleNode("//table1//Cell[@colindex ='1']");
    if (node != null)
    {
    node.Attributes["value"].Value ="cc";
    }DataSet ds = new DataSet();
    ds.ReadXml(new XmlNodeReader(doc));but why cannot you just doDataSet ds = new DataSet();ds.ReadXml(Request.PhysicalApplicationPath + "ReportFiles/" + filePath);directly??
      

  4.   

    Example
    The following example adds a new attribute to the XML document.using System;
    using System.IO;
    using System.Xml;public class Sample {  public static void Main() {    XmlDocument doc = new XmlDocument();
        doc.LoadXml("<book xmlns:bk='urn:samples' bk:ISBN='1-861001-57-5'>" +
                    "<title>Pride And Prejudice</title>" +
                    "</book>");    XmlNode root = doc.FirstChild;    //Create a new attribute.
        string ns = root.GetNamespaceOfPrefix("bk");
        XmlNode attr = doc.CreateNode(XmlNodeType.Attribute, "genre", ns);
        attr.Value = "novel";    //Add the attribute to the document.
        root.Attributes.SetNamedItem(attr);    Console.WriteLine("Display the modified XML...");
        doc.Save(Console.Out);  }
    }