Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use DataTable.Select(filterExpression, SortExpression) method

Status
Not open for further replies.

pinkpoppy

Programmer
Jul 6, 2011
75
US
I have a dropdownlist of names that I call from a web service. I need to select distinct, firstname, middlename, lastname, then order by lastname ASC. Can anyone help me on this? I am having some issues getting this to work.

Thanks, any help is appreciated!
 
To distinct:
newDataTable = origDatatable.DefaultView.ToTable(True, "Column you want to DISTINCT")
OR
newDataTable = origDatatable.DefaultView.ToTable(True)) //Will distinct on all columns in the datatable

Check out the overloads for the ToTable() method.

To sort, look into using a dataview
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top