This is the simplest and fastest code that implements multiple-column sorting in ASP (Sort Ascending & Sort Descending). Excellent for ASP/SQL beginers.

<style>
    th{font-family:arial;font-size.gif:10pt;}
    td{font-family:verdana;font-size.gif:9pt;}
</style>

 
<%
 Dim conn, connString
connString = "nwind"
 Set conn = Server.CreateObject("ADODB.Connection")
conn.Open connstring 
 
Dim rs, sql, url, fname, sort, lastsort, thissort
url = Request.ServerVariables("URL")
sql = "SELECT CompanyName, ContactName, Address, City, Phone From Customers"
sort = LCase(Request("sort"))
lastsort = LCase(Request("lastsort"))
 
If sort<>""Then
   If lastsort=sort Then
      thissort = sort & " desc"
   ElseIf InStr(lastsort, sort & " desc"Then
      thissort = Replace(lastsort, sort & " desc", sort)
   ElseIf InStr(lastsort, sort) Then
      thissort = Replace(lastsort, sort, sort & " desc")
   ElseIf ""lastsort<>Then
      thissort = lastsort & ", "& sort
   Else
      thissort = sort
   End If
   sql = sql & " ORDER BY "& thissort
 
End If
Response.Write "<P><B><FONT color=blue>ORDER BY</FONT>:</B> "& _
   thissort & "</P>"
Response.Write "<A href= """ & url & """>Reset Order</A>"
 
 
Set rs = conn.Execute(SQL)
 
'print headers
Response.Write "<TABLE border=1><TR>"
 For i=0 To rs.fields.count - 1
   fname = rs.fields(i).name
   Response.Write "<TH><A href= """ & url & "?sort= "& fname &"&lastsort= "& _
      thissort & ""
">"& fname 
   If InStr(thissort, lcase(fname & " desc")) Then
      Response.Write " -"
   ElseIf InStr(thissort, lcase(fname)) Then
      Response.Write " + "&nbsp;   
   End If
   Response.Write "</TH>"
 Next
Response.Write "</TR>"
 
'print recs
 Do While Not rs.eof
   Response.Write "<TR>"
   For i=0 To rs.fields.count - 1
      Response.Write "<TD>"& rs(i) & "</TD>"
   Next
   Response.Write "</TR>"
   rs.movenext
 Loop
Response.Write "</TABLE>"
 
rs.close
conn.Close 
 Set rs = Nothing
 Set conn = Nothing
%>