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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top