DataTable中数据针对某列数据去重

        //针对这些数据进行去重,取某一列就用这一列字段,把重复的去掉
       DataSet ds = dao.get();
        
       DataTable dt = ds.Table[0]
       DataView dv = dt.DefaultView; DataTable dt1 = dv.ToTable(true, "IADDDTIME"); for (int g = 0; g < dt1.Rows.Count; g++) { DateTime ITAADDDTIME = Convert.ToDateTime(dt1.Rows[g]["IADDDTIME"].ToString()); if (g == dt1.Rows.Count - 1) date += ITAADDDTIME.Year + "" + ITAADDDTIME.Month + "" + ITAADDDTIME.Day + ""; else date += ITAADDDTIME.Year + "" + ITAADDDTIME.Month + "" + ITAADDDTIME.Day + "" + ""; }

 

你可能感兴趣的:(DataTable中数据针对某列数据去重)