Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to create dynamic where clause

Status
Not open for further replies.
Sep 25, 2002
159
US
hello,

I created an asp page that will allow users to click on any number of checkbox options and click submit. When they get to the action page, these checkboxes they chose should generate a report based on their selections. The problem is, I can't predict the combination or the amount of options they may choose. How is the best way to compensate for this in regards to my where clause?

below is my sql statement as it works now with only one option chosen:

componentName = Request.QueryString("component")

mySQL = "SELECT * FROM getBarcelonaBestPerformersByComponent"

'WHERE STATEMENT
If componentName <> "All" then
mySQL = mySQL & " WHERE Component = '" & componentName & "';"
end If
 
How about IN:
Where ComponentName IN ("a","b","c")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top