Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP.net filter on a data table to read unique items

Hi

I usually use the following SQL statement coupled with a reader to populate an ASP.net DropDownList. In my latest solution I am trying to read the same items using a filter.
I'm not quite sure how to use Distinct or create get unique items from the following code  
How would I adjust the following line marked XXXX  ?

  xSQLTable_Accounts.DefaultView.RowFilter = "[Segment 1 Desc]=*"  'XXXX

                With Me.Category1.Items
                    .Clear()
                    For i As Integer = 0 To xSQLTable_Accounts.DefaultView.Count - 1
                        .Add(xSQLTable_Accounts.DefaultView.Item(i).Item("Segment 1 Desc"))
                    Next
                End With
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

Thanks very much
Minor alteration: had to take square brackets out to get it to work
  Dim dTemp As DataTable = xSQLTable_Accounts.DefaultView.ToTable(True, "Segment 1 Desc")
Thanks again!