请问如何根据它的memberSerials如果memberSerials字段相同只在GridView中显示同个帐号的最高分如图GridView数据从xml中读出,字段依次为:memberSerials、names、s、times,经过DataSet数据使用过DataView将分数以大小排序,代码如下:
DataSet ds = new DataSet();
        ds.ReadXml(Server.MapPath("xmls/tops20.aspx"));
        XmlDocument doc = new XmlDocument();
        doc.Load("xmls/tops20.aspx");
ds.Tables[0].Columns.Add("iPersonOrderSort", System.Type.GetType("System.Int32"));
ds.Tables[0].Columns["iPersonOrderSort"].Expression = "Convert(s,'System.Int32')";
        DataView tableview = ds.Tables[0].DefaultView;
        tableview.Sort = "iPersonOrderSort desc";
        GvList.DataSource = tableview;
        GvList.DataBind();
请问如何根据它的memberSerials判断如果GridView中memberSerials字段有相同。只在GridView中显示同个帐号(memberSerials)的最高分。s为分数。麻烦高人了,在下坐等结贴。

解决方案 »

  1.   

    你是要查找memberSerials 最高的用户信息?
      

  2.   

    就是同一个用户s最高的那个在GridView。
    就是将GridView中相同用户的低分数过滤掉。
      

  3.   

    http://bbs.csdn.net/topics/20450903
    参考吧
      

  4.   

    我感觉先把ds的数据放到hashtable里,然后在绑定gridview。hashtable ht = new hashtable();for(int i=0;i<ds.table[0].rows.count;i++)
    {
      person p = new person ();
      if(ht.contains(ds.table[0].rows[i]["memberSerials"].tostring()))
      {
         p = (person)ht[ds.table[0].rows[i]["memberSerials"].tostring()];
         if(p.s < ds.table[0].rows[i]["s "].tostring())
         {
            p.s = ds.table[0].rows[i]["s "].tostring();
            ht.remove(ds.table[0].rows[i]["memberSerials"].tostring());
            ht.add(ds.table[0].rows[i]["memberSerials"].tostring(),P)
         }
      }
      else
      {
        p.memberSerials = ds.table[0].rows[i]["memberSerials"].tostring();
        p.names = ds.table[0].rows[i]["names "].tostring();
        p.s  =  ds.table[0].rows[i]["s "].tostring();
        p.times = ds.table[0].rows[i]["times "].tostring();
         ht.add(ds.table[0].rows[i]["memberSerials"].tostring(),P)
      }
    }不知道对不对瞎写的啊 感觉是是可以的
      

  5.   

    你好,请问hashtable 数据怎么转换为DataSet?