ASP - search functionality and the 'LIKE'

Results 1 to 2 of 2

Thread: ASP - search functionality and the 'LIKE'

  1. #1
    Join Date
    Dec 1969

    Default ASP - search functionality and the 'LIKE'

    I am working with a search function for my database.<BR>But there are things that I am unsure of in the sample script I am looking at.<BR><BR>First of all I have an incredibly simple function working and it uses the sql term LIKE in the query. But it will only return a result if the entire term is found the the database, instead of maybe looking for maybe 2 out of the three words. So surely this is exactly the same as just using equals.<BR><BR>so whats the point of LIKE???<BR><BR>another thing I have noticed with this script is that the author puts his form variable into the sql query like this: <BR><BR>&#039;%strSearch%&#039;<BR><BR>why are there percentages in there instead of writing it like this:<BR><BR>&#039;"&strSearch&"&#039;<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: ASP - search functionality and the 'LIKE&

    No it is not the same as equals<BR><BR>Field contains "there are many was to use like to find what you want"<BR><BR>Select ... like &#039;%use%&#039;<BR><BR>This would return this row.<BR><BR>% in the SQL String means any character or set of characters or no characters<BR><BR>If you have for instance a field that stores you first name and you want only the firstnames that begin with A<BR><BR>Select ... from firstname like &#039;A%&#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