Search for a word

Results 1 to 2 of 2

Thread: Search for a word

  1. #1
    Join Date
    Dec 1969

    Default Search for a word

    Hi all,<BR>Can anybody tell me how to search for word in a database field<BR>based on the user input in a form field.<BR>We can do some thing like this.<BR>"Select * from categories<BR>where category_description Like &#039%" & Request.Form("searchtext")&"%&#039"<BR><BR>The above would return all rows which contain the input string.<BR>For example If the user searches for "Lights" , the Query would not only return all records which have "Lights" word in the Category Description field but also would return "Flights" <BR>in the Category Description field . Hope you got what I am trying to say.<BR><BR>To solve this we can change the Query little bit Like below.<BR>"Select * from categories<BR>where category_description Like &#039" & Request.Form("searchtext")&"&#039"<BR><BR>But what if a row contains multiple words in the Category_description field Like, "Bulbs and Lights".<BR>With the second query we cannot retrieve this row as the keyword<BR>"Lights" is neither the exact matching of the word "Bulbs and Lights" nor it is the first word in the sentence.<BR><BR>I know this requires a bit of string manipulation , but if somebody can throw little light on how to achieve this, I can carry on with the rest.<BR><BR>thanks a lot for your time.

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default RE: Search for a word

    try this<BR>like &#039% " & Request.Form("searchtext") & " %&#039"

Posting Permissions

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