Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    51

    Smile Unanswered: How to Search in asp

    Hello Thanks for the support

    hey

    I have page where is want to search my db, this is the statement i have now
    SELECT *
    FROM ServiceInfo
    WHERE (Keywords LIKE '%MMColParam1%' AND ActualLocation LIKE '%MMColParam2%')
    ORDER BY Program ASC

    MMColParam2 XXXX Request("Search_ActualLocation")
    MMColParam1 XXXX Request("Search_Keyword")

    I can search the two fields together but i also wanted to search either by keyword or by location. i needs to search by any field or both fields.

    Any Sugggestions

  2. #2
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Then keep adding to the WHERE clause...

    ... WHERE (field1 LIKE value1 AND field1 LIKE value2) OR (field3 LIKE value3 AND field4 LIKE value4)
    That which does not kill me postpones the inevitable.

  3. #3
    Join Date
    Mar 2004
    Posts
    51

    Smile

    Im not really sure what u are saying if i have two box's. One is a txtfield and the other is a list box. I want to be able to search either the txtbox or the list box or both. So i should have 3 where statements following one another and do is use the same variables for the sql string???

    Not too good at sql sorry.

    Newfiebullet

  4. #4
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    You want to search the text box or list box? Or you want to use the values in the text box and list box to search the database?

    If it's the later, you would have two statements in your WHERE clause:

    ... WHERE field1 = textboxValue OR field1 = listboxValue
    That which does not kill me postpones the inevitable.

  5. #5
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Maybe this will give you some ideas:

    ASP Design Tips - Search For an Expression on Multiple Fields
    http://www.bullschmidt.com/devtip-se...iplefields.asp
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

Posting Permissions

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