0

I've got a datatable that I need to sort and place back into another datatable. On the face of this its easy as below:

 DataTable sortme = getdata();
 sortme.Select("col1 = 'something'", "sortbyme ASC").CopytoDataTable();

However, I've found as soon as I pass the DataRow array created by select() to CopytoDataTable(), the new datatable is no longer sorted by sortbyme.

How do I fix this without creating a loop to push each DataRow into a datatable? And what is causing the sorting to be lost?

sunrunner20
  • 191
  • 1
  • 10

1 Answers1

0

There is already a question asked and solved about how to sort DataTables by row, please look at it here, it might help you:

Sorting rows in a data table

Community
  • 1
  • 1