To find distinct records based column or columns, i have found this is the simplest way.
string[] columns=new string[dtTable .Columns.Count];
int i=0;
foreach (DataColumn dc in dtTable.Columns)
{
columns[i++] = dc.ColumnName.Trim();
}
dtTable = dtTable.DefaultView.ToTable(true, columns);
return dtTable;
string[] columns=new string[dtTable .Columns.Count];
int i=0;
foreach (DataColumn dc in dtTable.Columns)
{
columns[i++] = dc.ColumnName.Trim();
}
dtTable = dtTable.DefaultView.ToTable(true, columns);
return dtTable;
No comments:
Post a Comment