If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Sort RecordSet once it's returned?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-26-05, 13:42
dotolee dotolee is offline
Registered User
 
Join Date: Feb 2003
Posts: 107
Sort RecordSet once it's returned?

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?
Reply With Quote
  #2 (permalink)  
Old 01-26-05, 15:13
DrewM DrewM is offline
Registered User
 
Join Date: Jan 2005
Posts: 36
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
Reply With Quote
  #3 (permalink)  
Old 01-26-05, 17:16
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
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?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On