View Single Post
  #2  
Old 08-24-2006, 02:28 PM
invincible invincible is offline
OSP Starters
 
Join Date: Apr 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
invincible is on a distinguished road
Default

Use a querystring

dim vOrderBy, strSQL

vOrderBy = ""
vOrderBy = request.querystring("ob")

strSQL = ""
strSQL = "SELECT * from tab_Whatever ORDER BY "&vOrderBy&" "

Your links would be <a href="link.asp?ob=a">Link</a>

Or you could even put little Up/Down arrows at the top of each column and then pass an ASC or DESC

Dim vOrderBy, vOrder, strSQL

vOrderBy = ""
vOrder = ""
strSQL = ""

vOrderBy = ""
vOrderBy = request.querystring("ob")

vOrder = ""
vOrder = request.querystring("o")

Select case vOrder
Case "a"
vOrder="ASC"
Case "d"
vOrder="DESC"
End Select

strSQL = " -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  Webmaster Forums - View Single Post - ORDER BY a column?
View Single Post
  #2  
Old 08-24-2006, 02:28 PM
invincible invincible is offline
OSP Starters
 
Join Date: Apr 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
invincible is on a distinguished road
Default

Use a querystring

dim vOrderBy, strSQL

vOrderBy = ""
vOrderBy = request.querystring("ob")

strSQL = ""
strSQL = "SELECT * from tab_Whatever ORDER BY "&vOrderBy&" "

Your links would be <a href="link.asp?ob=a">Link</a>

Or you could even put little Up/Down arrows at the top of each column and then pass an ASC or DESC

Dim vOrderBy, vOrder, strSQL

vOrderBy = ""
vOrder = ""
strSQL = ""

vOrderBy = ""
vOrderBy = request.querystring("ob")

vOrder = ""
vOrder = request.querystring("o")

Select case vOrder
Case "a"
vOrder="ASC"
Case "d"
vOrder="DESC"
End Select

strSQL = " -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote