Results 1 to 4 of 4

Thread: *Multiple Criteria Search*

Threaded View

  1. #1
    Join Date
    Aug 2005
    Posts
    16

    Question *Multiple Criteria Search*

    Ok, here is my situation: I have an asp page that should display results out of a real estate database. I want people to be able to choose exactly what they want to see so i provided them with 3 dropdown lists. This is what my code looks like:

    <%If request("propertySearch") = "Search" Then
    Set property_data=db.Execute("SELECT * FROM property "&_
    If request("descriptionSelect") <> "any" Then
    "WHERE Description= '"&request("descriptionSelect")&"'"&_
    End if
    If request("suburbSelect") <> "any" Then
    "AND Suburb= '" & request("suburbSelect")& "'"&_
    End if
    If request("buyRentSelect") <> "any" Then
    "AND buyRent= '" & request("buyrentSelect")& "'"&_
    End if
    "")
    %>

    The problem is that i dont know how to compile a SQL statement depending on what is selected because not all dropdown lists are sometimes selected and their value should be ignored. I thought i could use If and Else clauses to do this (like above) but it doesnt work.
    Could someone please point me into the right direction?
    Thanx
    Last edited by xrookie; 10-18-2005 at 05:44 AM.

Posting Permissions

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