Below code will help us to get the distinct records from datatset tables
string[] TobeDistinct = { "Column1", "column2", "column3",........."columnn"};
DataTable dtDistinct = GetDistinctRecords(datatable, TobeDistinct);
public static DataTable GetDistinctRecords(DataTable dt, string[] Columns)
{
DataTable dtUniqRecords = new DataTable();
dtUniqRecords = dt.DefaultView.ToTable(true, Columns);
return dtUniqRecords;
}
| |