Results 1 to 5 of 5

Thread: SQL Query

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Seattle
    Posts
    954

    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

  2. #2
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    I'm sorry, I don't understand this question.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Seattle
    Posts
    954
    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?

  4. #4
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    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.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  5. #5
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    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..
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

Posting Permissions

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



Click Here to Expand Forum to Full Width