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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataTable Sorting

Status
Not open for further replies.

jbsys

Programmer
May 6, 2005
51
CA
Hi;
Does anyone know of a simple way to sort the rows of a datatable based on the value of one of the columns? Code Example would be greatly appreciated.

Thanks

jbsys.
 
The DataView provides ways for sorting data in a DataTable.
Code:
DataTable dt; // datatable with firstname, lastname, city
DataView dv = dt.DefaultView;
dv.Sort = "city, lastname DESC"; // City column sorted ASC (default) and lastname DESC;
obislavu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top