-
SQL Query
I am building a query via a combo box. I have a place in there to chose a site, I am having a hard time with multiple sites though. Here is my code.
*********This is the query that will be built after they chose the combo box....
strQ = "Select * from tblEmp where phone <> null and ACES_USER <> null and site in ('" & strCSO & "') order by LName ASC"
************These are the combo boxes
<select name="cboCSO" id="cboCSO" size="1" align="center">
<option <% If strCSO = "111,13" then response.write "SELECTED" End If%> value="111, 13"> All</option>
<option <% If strCSO = "111" then response.write "SELECTED" End If%> value="111"> Region</option>
<option <% If strCSO = "13" then response.write "SELECTED" End If%> value="13"> Moses Lake/Mattawa</option>
<option <% If strCSO = "4" then response.write "SELECTED" End If%> value="4">Wenatchee</option>
<option <% If strCSO = "60" then response.write "SELECTED" End If%> value="60">Spokane SW</option>
<option <% If strCSO = "58" then response.write "SELECTED" End If%> value="58">Spokane Valley</option>
<option <% If strCSO = "24" then response.write "SELECTED" End If%> value="24">Okanogan</option>
<option <% If strCSO = "59" then response.write "SELECTED" End If%> value="59">Spokane North</option>
<option <% If strCSO = "33" then response.write "SELECTED" End If%> value="33">Colville</option>
<option <% If strCSO = "2" then response.write "SELECTED" End If%> value="2">Clarkston</option>
<option <% If strCSO = "26" then response.write "SELECTED" End If%> value="26">Newport</option>
<option <% If strCSO = "10" then response.write "SELECTED" End If%> value="10">Republic</option>
<option <% If strCSO = "22" then response.write "SELECTED" End If%> value="22">Davenport</option>
<option <% If strCSO = "38" then response.write "SELECTED" End If%> value="38">Colfax</option>
<option <% If strCSO = "1" then response.write "SELECTED" End If%> value="1">Othello</option>
</select>
All
-
I'm sorry, I don't understand this question.
-
OK,
Here goes....There is a combo box named cboCSO. With this combo box I am dynamically building a query. The combo box basically allows the user to select a site. If I want to query all of the sites I am having a problem with the query. Do you see where I am going with this?
-
Maybe. There is an option to allow multiple selections in a select input (and I would suggest a size greater than 1 for a friendly-UI). Check W3C. But I'm not sure if that is the information you are going for. And I'm not exactly sure how that information shows up in the Request object.
-
You will need an if statement where you check for the 'ALL' value. If it's there, you need to not include the where clause that limits on site name. Otherwise, do what you were doing..