Get distinct values from a column in a datatable

  • Thread starter Thread starter jvb
  • Start date Start date
J

jvb

I am trying to find a way, other than iterating through every row or
requerring the database, to get the distinct values from a column in a
datatable.

Any help would be appreciated.

Thanks.
 
You will have to iterate over the rows so that you may compare for distinct
values. However, the logic may be prepared generically.

Each datatable has a getenumerable method. internally, it loops over the
list. You could create a generic GetDistinctEnumerable and pass in the
datatable's enumerable. Perhaps you could then bind your data list repeater
or datagrid to the result set.
 
Back
Top