View Full Version : Sorting Results...
The Wizzard
01-12-2003, 09:13 PM
How do you allow users to sort results from a database...
If you have lets say, 10 fields in the database, you want to allow 7 specific fields to be sorted...
Does it make any sense?
hehe
THanks
bostjank
01-12-2003, 10:19 PM
Simly prepare links that reload your page with certain querystring value. Then retrieve that value and use appropriate SELECT statement
link: page.asp?sortby=filed1&order=asc
<%
sSortBy = Request.QueryString("sortby")
sSortOrder = Request.QueryString("order")
'open database
...
sSQL = "SELECT * FROM table WHERE ... ORDER BY " & sSortBy & " " & sSortOrder
set rs = ...
%>
Hope it helps,
Bostjan
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.