20 June 2014

How to remove duplicate records from datatable in c#



 private DataTable RemoveDuplicatesRecords(DataTable dt)
 {
    var UniqueRows = dt.AsEnumerable().Distinct(DataRowComparer.Default);
    DataTable dt2 = UniqueRows.CopyToDataTable();
    return dt2;
  }

No comments:

Post a Comment