一些常用的方法(1)--去除DataTable中的重复数据

private DataTable Display(DataTable dtSource)
        {
            DataTable dtTemp = dtSource.Copy();
            foreach (DataRow dr in dtSource.Rows)
            {
                DataRow[] drRepeat = dtTemp.Select("AA='" + dr["AA"].ToString().Trim() + "' and BB='" + dr["BB"].ToString().Trim() + "'");
                if (drRepeat.Length > 1)
                {
                    for (int i = 0; i < drRepeat.Length - 1; i++)
                    {
                        dtTemp.Rows.Remove(drRepeat[i]);
                    }
                }
            }
            return dtTemp;
        }

上一篇:AOJ 0118 Property Distribution【DFS】


下一篇:Docker Device Mapper 使用 direct-lvm