Sorting Data With Forms and an ORDER BY SQL Statem

Results 1 to 2 of 2

Thread: Sorting Data With Forms and an ORDER BY SQL Statem

  1. #1
    Join Date
    Dec 1969
    Posts
    45

    Default Sorting Data With Forms and an ORDER BY SQL Statem

    I have an Access database connected with ASP to the web. I am somewhat familar with the ORDER BY statment as it is used within Access, but I cannot figure out how to pass a request from a drop down form field as a parameter to the SQL ORDER BY statement so that it will recognize the field in the database that I would like to sort by. Can you tell me how to make a SQL ORDER BY statement that will sort according to a choice that someone makes from a drop down form field value on a web page? Thanks.

  2. #2
    Join Date
    Dec 1969
    Posts
    1,019

    Default RE: Sorting Data With Forms and an ORDER BY SQL St

    Try this:<BR>pg1 has a dropdown named &#039myfield&#039 which is posted to pg2.asp<BR><BR>pg2.asp<BR>dim sql<BR>sql="SELECT * FROM myTbl "<BR>sql=sql & "ORDER BY " & request.form("myfield")<BR>dbconn.excute(sql)<BR>

Posting Permissions

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