Sort by records of DataTable

xiaoxiao2021-03-06  63

Use DataView DataView DV = New DataView (DATATABLE); DV.SORTING = "Sort by column name"; // Sort by ASC | DESC -------------------------------------------------------------------------------------------------------- ---------------------------------------- DataView DV = DATATABLE1.DEFAULTVIEW; DV.SORT = "ID ASC"; -------------------------------------------- ---------------- // If the Dataset has been taken, then your requirements cannot be achieved. //1. This method can also be used to filter DATAROW // 2 using a DataTable SELECT. Add the sequence of DataRow to DataTable

String strexpr = ""; string strsort = "column desc"; DATAROW [] DR = DS1.TABLES [0] .Select (STREXPR, STRSORT); DS1.TABLES [0] .clear (); Foreach (DataRow Next In DR) ) {DS1.TABLES [0] .Rows.Add (next);

// Datun me!

转载请注明原文地址:https://www.9cbs.com/read-87069.html

New Post(0)