After duplicate data to be processed in the dataset, the write, is used to keep
/// <Summary>
/// Gets a new fixed columns do not overlap the DataTable
/// </ Summary>
/// <param name = " dt "> containing duplicated data the DataTable </ param>
/// <param name =" colName "> duplicate column names need to verify </ param>
/// <Returns> new DataTable, colName columns are not repeated, tabular unchanged </ Returns>
Private the DataTable GetDistinctTable (the DataTable dt, String colName)
{
the DataView DV = dt.DefaultView;
the DataTable dtCardNo = dv.ToTable (to true, colName);
the DataTable Pointdt the DataTable new new = ();
Pointdt = dv.ToTable ();
Pointdt.Clear ();
for (int I = 0; I <dtCardNo.Rows.Count;i++)
{
DataRow dr = dt.Select(colName + "='" + dtCardNo.Rows[i][0].ToString() + "'")[0];
Pointdt.Rows.Add(dr.ItemArray);
}
return Pointdt;
}
Reproduced in: https: //www.cnblogs.com/zhangchenliang/archive/2009/12/30/1636094.html