How to sort a DataTable:

foreach(DataRow row in table.Select(“”, “RecordId ASC”)) {

// Operations

}

 

Will return an array of data rows, sorted by RecordID