Can I sort my ADODB.Recordset by a field once the recordset is already created or should I be doing this at the SQL SELECT level / point? Is there a sort option for the recordset?
No.1 | | 337 bytes | |
it's easier to sort it in SQL
just add ORDER BY fieldname at the end with ASC (ascending) or DESC (descending) at the end. You can have multiple order by fields also, the non-primary fields are used when the primary fields are equal
eg
SELECT * FROM mytable ORDER BY myimportantcolumn, myimportantcolumn2
No.2 | | 219 bytes | |
After the RecordSet is created you cannot sort records in the RecordSet. But I think there is a way to sort them using ASP code. That may reduce the performance. Why don't you sort the records in the SQL statement?