Sorting recordsets

Results 1 to 3 of 3

Thread: Sorting recordsets

  1. #1
    Join Date
    Dec 1969

    Default Sorting recordsets

    I was wondering if anyone knew how to do this. I have a database which the user can search, pulling up the relevant results into a table this isn't a problem, is it possible to allow the user to click on the title of any column, (ie book title, author etc), and the results get sorted in alphabetic order according to that column.

  2. #2
    md Guest

    Default RE: Sorting recordsets<BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Sorting recordsets

    I&#039;ve got something like this on our corporate intranet&#039;s phone directory and is probably adaptable.<BR><BR>Each title heading has a hyperlink similar to &#060;A HREF="phonebook.asp?sortby=first"&#062;First Name&#060;/A&#062;<BR><BR>The ASP then has a SQL script built in the following manner:<BR>sSQL="SELECT * FROM tblEmployees ORDER BY "<BR><BR>SELECT Request.Querystring("sortby")<BR> CASE "first"<BR> sSQL=sSQL & "FirstName"<BR> CASE "last"<BR> sSQL=sSQL & "LastName"<BR> CASE "dept"<BR> sSQL=sSQL & "Department"<BR> CASE else &#039;if nothing else works<BR> sSQL=sSQL & "LastName" <BR>END SELECT<BR><BR>If the sort is only required on one field, the above works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts