Forums

ASP

This topic is locked

Dynamic ORDER BY clauses

Posted 20 Jul 2001 17:48:38
1
has voted
20 Jul 2001 17:48:38 Bec C posted:
On a query can I make the ORDER BY chosenField Desc 2 dynamic variables (1 for field to sort and 1 for the type of sort) so that the 1 recordset can be sorted in a manner of ways?

At the moment I am using lots of IF statements which seems rather cumbersum to me.

I tried making the DESC/ASC bit a variable but I received an error.

Replies

Replied 22 Jul 2001 14:42:18
22 Jul 2001 14:42:18 Joel Martinez replied:
nope, unfortunately the conditional statement approach is the only way...

if you're worried about scalability (like if you have to change it in the future, and don't want to change a billion pages) put it in an asp page that you can include at the top of every page, then put the procedure that builds the order by clause in a function...

Joel Martinez

----------
Is this thing on?....

Reply to this topic