错误:名为“comments”的列已属于此 DataTable。        DataSet ds = new DataSet();
        ds.ReadXml("http://community.csdn.net/ASCX/NewHomePage/ModeratorRecommend/ModeratorRecommendTech.xml");
        gvCSDN.DataSource = ds.Tables[0].DefaultView;
        gvCSDN.DataBind();第二句报错了。

解决方案 »

  1.   

    <?xml version="1.0" ?> 
    - <rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">
    - <channel>
      <title>CSDN社区 → 社区首页 → 版主推荐技术热贴</title> 
      <link>http://community.csdn.net/</link> 
      <description>CSDN社区 → 社区首页 → 版主推荐技术热贴</description> 
      <language>zh-CN</language> 
      <generator>community.csdn.net</generator> 
      <copyright>Copyright 1998 - 2009 CSDN.NET Inc. All Rights Reserved</copyright> 
    - <item>
      <title>炸弹超人游戏 + [源码] + [原创]</title> 
      <link>http://topic.csdn.net/u/20100216/21/25A07EA1-99E8-4906-A743-FCF25DBD77CD.html</link> 
      <author>qq369860303</author> 
      <guid>http://topic.csdn.net/u/20100216/21/25A07EA1-99E8-4906-A743-FCF25DBD77CD.html</guid> 
      <pubDate>Fri, 19 Feb 2010 08:08:00 GMT</pubDate> 
      <comments>http://topic.csdn.net/u/20100216/21/25A07EA1-99E8-4906-A743-FCF25DBD77CD.html</comments> 
      <slash:comments>0</slash:comments> 
      <source url="http://topic.csdn.net/u/20100216/21/25A07EA1-99E8-4906-A743-FCF25DBD77CD.html">炸弹超人游戏 + [源码] + [原创]</source> 
      <description>炸弹超人游戏 &nbsp; + &nbsp; [源码] &nbsp; + &nbsp; [原创]</description> 
      </item>
    - <item>
      <title>过年了,分享我刚刚学的一些验证字符串方法,全角半角,数字,汉字,生命周期,控件使用等等</title> 
      <link>http://topic.csdn.net/u/20100211/09/BD7C3CA0-ECC9-49AD-9DEA-2CDC449B0F44.html</link> 
      <author>Jelly_tracy</author> 
      <guid>http://topic.csdn.net/u/20100211/09/BD7C3CA0-ECC9-49AD-9DEA-2CDC449B0F44.html</guid> 
      <pubDate>Fri, 19 Feb 2010 08:08:00 GMT</pubDate> 
      <comments>http://topic.csdn.net/u/20100211/09/BD7C3CA0-ECC9-49AD-9DEA-2CDC449B0F44.html</comments> 
      <slash:comments>0</slash:comments> 
      <source url="http://topic.csdn.net/u/20100211/09/BD7C3CA0-ECC9-49AD-9DEA-2CDC449B0F44.html">过年了,分享我刚刚学的一些验证字符串方法,全角半角,数字,汉字,生命周期,控件使用等等</source> 
      <description>过年了,分享我刚刚学的一些验证字符串方法,全角半角,数字,汉字,生命周期,控件使用等等</description> 
      </item>
    - <item>
      <title>[过年散分]一个简单的WebSerivce传递图片的例子</title> 
      <link>http://topic.csdn.net/u/20100210/18/6220EB3E-A6BF-46CA-9069-2D133F998568.html</link> 
      <author>Lost_Painting</author> 
      <guid>http://topic.csdn.net/u/20100210/18/6220EB3E-A6BF-46CA-9069-2D133F998568.html</guid> 
      <pubDate>Fri, 19 Feb 2010 08:08:00 GMT</pubDate> 
      <comments>http://topic.csdn.net/u/20100210/18/6220EB3E-A6BF-46CA-9069-2D133F998568.html</comments> 
      <slash:comments>0</slash:comments> 
      <source url="http://topic.csdn.net/u/20100210/18/6220EB3E-A6BF-46CA-9069-2D133F998568.html">[过年散分]一个简单的WebSerivce传递图片的例子</source> 
      <description>[过年散分]一个简单的WebSerivce传递图片的例子</description> 
      </item>
      </channel>
      </rss>
    1L,应该怎么弄啊?
      

  2.   


    //using System.Xml;下面的自己写吧XmlDocument xmld = new XmlDocument();
                xmld.Load("http://community.csdn.net/ASCX/NewHomePage/ModeratorRecommend/ModeratorRecommendTech.xml");            XmlNodeList XnodeList = xmld.SelectSingleNode("rss").ChildNodes;
                foreach (XmlNode item in XnodeList)
                {
                    for (int i = 0; i < item.ChildNodes.Count; i++)
                    {
                        Console.WriteLine(item.ChildNodes[i].InnerText);
                    }
                   
                }还有的自己去google一下google一下
      

  3.   

    ds.Clear(); 
    需要把列从DataTable的Columns中先移除,然后再添加到新的DataTable中。