-
*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.
-
This kind of small app canturn your hair white if you do it in raw asp/aspx. Check out the product of this forum (www.aspdb.com) and it probably can save your day.
Fk
-
Thanks Frank, i'll have a look and give it a try.
-
See my reply to your next question. If you are struggling with the how-to's in Web Applications development then you'l be a long way fromporductive. Especially when platform changes like VS2005, you have to re-code a lot as they change things around. Id you use a library and a good one will shield these changes and you do nothave to change your code.
Fk
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|