dt消除重复行,筛选数据

 

DataView dvInputData = new DataView(dt);
        dvInputData.Sort = "colName";
        DataTable dtInputData = dvInputData.ToTable();
        for (int i = 1; i < dtInputData.Rows.Count; i++)
        {
            if (dtInputData.Rows[i]["colName"].ToString() == dtInputData.Rows[i - 1]["colName"].ToString())
            {
                dtInputData.Rows.RemoveAt(i);
                i--;
            }
        } 

 

        //DataTable rtDt = dt.Clone();
        //rtDt.Rows.Add(dt.Select("TRUKER = '" + objZTruReq.TRUKER + "'"));
        //return rtDt;

posted on 2007-10-19 10:08  LongSky  阅读(204)  评论(0编辑  收藏  举报

导航