Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

USING 'LIKE' In Where Clause

Status
Not open for further replies.

CrimsonDiva

Programmer
Sep 22, 2000
30
US
Hello,
I'm trying to provide a database search using pattern matching. For instance, a user wants to search for all occurences of the word "access" in my database. I'm having trouble writing the SQL portion of this code. This is what I have now:

SrcTxt = Request.Form("SearchTxt")

sql = "SELECT Synopsis, Desc, Answer " & _
"FROM FAQ " & _
"WHERE Synopsis LIKE '" &SrcTxt& "%' " & _
"ORDER BY Synopsis; "

Where "SearchTxt" is the name of the text field in the search. When I run the above code (with the ASP file), it produces no results even though I know that it should produce at least 1 record. PLEASE HELP!!!
[sig][/sig]
 
maybe it finding all &quot;access%&quot; meaning, unless it starts with access it returns no result, try %thetext% [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top