Showing posts with label Remove duplicate rows. Show all posts
Showing posts with label Remove duplicate rows. Show all posts

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;
  }