Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQL Search Statement

0 views
Skip to first unread message

Blackout

unread,
May 5, 2002, 3:31:51 PM5/5/02
to
I have this sql statement and it points to a description field where any
kind of text can be entered. So if I have a text string in the description
field like this "woodworking products" and I have a text box on one asp
page and go to search the database field for something similar to "wood
products" nothing shows up. but if I use a string of "products" it returns
the row. if I use "working" it returns but when I use "wood products" it
doesn't find the row. Here is my sql statement


Tom Barnett

unread,
May 8, 2002, 8:35:31 AM5/8/02
to
Try replacing all spaces in the string with the wildcard character (%),
surrounding it with wildcards, and using 'like' in your query:
Dim strSearchString
strSearchString = "%" & Replace(Request.Form("txtSearch"),Chr(32),"%") &
"%"

Your query will wind up looking something like:
Select * from SomeTable where SearchField like '%wood%products%'

This query should return any row in which this field contains the words
wood and products.

Tom Barnett
Senior Software Engineer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

0 new messages