sort query on an asp file

Results 1 to 2 of 2

Thread: sort query on an asp file

  1. #1
    Join Date
    Dec 1969
    Posts
    309

    Default sort query on an asp file

    I have an asp file which displays a table of the result of a search query. Many times, this table returns a long list of matched records.<BR>I want to create a sort query that when I click on the header of the field (of the talble)it would sort and display the data ascendantly. ( Maybe--first click would sort accendantly and next click would decendantly)<BR>Can someone please help me with this!!??<BR><BR>

  2. #2
    lincolntc Guest

    Default RE: sort query on an asp file

    You should have something similar to this:<BR><BR>&#060;%<BR>Set vConnection = Server.CreateObject("ADODB.Connection")<BR><BR>vCo nnection.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath("united.mdb")<BR><BR>Set vCommand = Server.CreateObject("ADODB.Command")<BR><BR>vComma nd.CommandText = "SELECT dept FROM united GROUP BY dept"<BR>vCommand.CommandType = 1<BR><BR>Set vCommand.ActiveConnection = vConnection<BR> <BR>Set vRecordSet = Server.CreateObject("ADODB.Recordset")<BR> <BR>vRecordSet.Open vCommand<BR>%&#062;<BR><BR>It is the GROUP BY command that will cause the sort to happen. This is the exact syntax from one of my files. I took it directly from an ASP book. I had to modify it to fit my needs, but the gist of it is the same. Use of the Group By command will also remove duplicate records.

Posting Permissions

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