Dian, 

I'm assuming this is with a web application.

The "best way" to do it mainly depends on the amount of results. If the RS is a quick 
query, you can just reload the page and build the RS given the user's choice of "view 
by".

The way I usually do it is just build a link button with the querystring values of 
"id=x&viewby=[date/article/rating]". [NOTE: I usually try to keep the selected id in 
the querystring, as opposed to a Session variable, but either way works.]

So when the page reloads and you build the SQL for the RS, you can determine the 
'order by' based on the state of request.querystring("viewby"). For a quick'n'dirty 
example,

If request.querystring("viewby") = "date" then
        SQL = "Select * from Table WHERE ID = " & [request.querystring("id") or 
Session("ID")] & " ORDER BY DateField"
Else
        SQL = [default SQL]
End if

If you go this route, you'll probably want to use a select case to handle all the 
different possible SQL statements.

Alternatly, if you have (or will eventually have) a ton of records with more than 250 
users and you can't afford to keep reloading the page everytime a user needs to 
reorder his results, you can always use javascript to reorder the result items on the 
client browser without having to reload the page. If so, I think there's plenty of 
free javascript code out there dealing with item sorting. 

Hope this helps and Good luck!

-Mat�as 



> -----Original Message-----
> From: Dian Chapman [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, May 15, 2004 8:25 PM
> To: Group - ASP
> Subject: [ASP] Can I resort an RS?
> 
> Hi folks...
> 
> I have a search for all records with a specific number. Now I 
> would like to enhance the results (display) by allowing the 
> author to not only see all the results of the search on their 
> ID, but to display the results in various ways, such as 
> highest to lowest rating...by article...by dates, etc. These 
> are all additional fields in the DB.
> 
> I'm just wondering what's the best way to do this and would 
> appreciate any advice. I assume I could just run another 
> search by holding the ID in a session var to allow me to 
> continue new searches with that author ID and other records, 
> depending on the new button they click...but I'm wondering if 
> I can run a search on a RS? 
> 
> I mean, I already have the RS with all the author's articles 
> displayed...can I do "something???" to resort this same RS in 
> another way??? Or do I just query for another RS with 
> different criteria? It SEEMS like resorting the current RS 
> might be the most efficient way to do it...but I don't know 
> how to do that...or IF its even possible.
> 
> TIA for any advice.
> 
> Cheers!
> 
> Dian ~
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.681 / Virus Database: 443 - Release Date: 5/10/2004
>  
> 
> 
> 
> --------------------------------------------------------------
> -------    
>  Home       : http://groups.yahoo.com/group/active-server-pages
> ---------------------------------------------------------------------
>  Post       : [EMAIL PROTECTED]
>  Subscribe  : [EMAIL PROTECTED]
>  Unsubscribe: [EMAIL PROTECTED]
> ---------------------------------------------------------------------
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/17folB/TM
---------------------------------------------------------------------~->

---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [EMAIL PROTECTED]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 

Reply via email to