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;
}
一些常用的方法(1)--去除DataTable中的重复数据
时间: 2024-10-29 04:07:18