p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Variable in "Order by" statement


Message #1 by "Lyle E Cooper" <lyle.cooper@w...> on Thu, 20 Jun 2002 20:15:30
> Actually, on further consideration, you're going to have a problem if the
user does not select any sort criteria, so you need to include the "ORDER
BY" part in the If Then:

  sqlAll= "Select * FROM Sites "
  sqlAll= sqlAll & " Where Site_Index > 0 "

  If NOT Sort1="" then
      sqlAll= sqlAll & " Order By Sort1"
  End If
  If Not Sort2="" then
      sqlAll= sqlAll & ", " & Sort2
  End If

Also, if they can select a criteria from the Sort2 field and not Sort1 you
need to validate for that and have them re-do the form or handle it in your
code somehow.

Greg


Greg,

I am working on the logic for any scenario with the 4 pull downs, or, if 
they select nothing (which is the easiest to do!) Thanks again.

  Return to Index