I guess the easiest way is to sort the data when fetching it from the database using an
ORDER BY clause[
^].
Other option is to sort the data already fetched but in order to do that we'd need to know in what kind of structure the data is stored in your program. Is it in data tables, POCO's and so on.