I wrote some code to sort my DataTable. Please refer to the code below:
// -------------------------------------------
// dsData is a DataSet containing a DataTable called "Table" that is loaded with unsorted data.
// I want the data in this DataTable to be sorted by PayeeName.
DataView dvData = new DataView(dsData.Tables[0]);
dvData.Sort = "PayeeName ASC";
dsData.Tables.Remove("Table");
dsData.Tables.Add(dvData.ToTable());
// -------------------------------------------
Is this an acceptable way to sort the DataTable, or is there a better way?
Thanks for any pointers.