when I fill a datatable can I get distinct rows for a specific column?

cwfontan

Active member
Joined
Jan 9, 2009
Messages
35
Programming Experience
1-3
i fill a datatable in a typed dataset.. it has cities and states but I want to pull just distinct states and bind it to a control etc..

:confused:

there is the filter, but i havent found a way to do distinct or group by. got to be a way without adding more datatables and filling them with data thats already there right?
 
Here is one way you could do it. Not sure it meets your requirements.

VB.NET:
        Dim dv As New DataView(dtExistingDataTable)

        Dim dtDistinctDataTable As DataTable = dv.ToTable(True, New String() {"State"})
 
Back
Top