|
 |
access_asp thread: Search on whole words or Wildcards only
Message #1 by "Eric Levine" <eric@d...> on Thu, 2 May 2002 08:08:34 -0400
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0003_01C1F1B0.92D9F420
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Good morning,
Anyone have an idea how I would go about creating the SQL necessary to
only search only on complete words, multiple words or by wild card? In
my current SQL statement, if someone were to simply put the letter 'a'
in the text box, they would receive any and all items that contain the
letter 'a'. In a real world scenario, if they wanted to see womens
products, they would get all of the womens products, as well as all of
the mens being that 'mens' is part of 'womens'. In addition, if I were
to put two words separated by a space, comma or what have you, the
statement simply gets kicked back as finding no results being it is
treating both words as a single string.
An example of my SQL statement is:
strSQL = "SELECT DISTINCT category " & _
"FROM qrySearch " & _
"WHERE category_name LIKE '%" & Replace(strSearch,"'","''") & "%' "
Many thanks for your help.
Regards,
Eric
Message #2 by "Charles Mabbott" <aa8vs@m...> on Thu, 02 May 2002 15:56:48 -0400
|
|
To handle the full name or partial name I am working with
FCC Amateur Call Signs and here is what I used for full
sign and partial sign
Dim strDirector, strCriteria
strDirector = Request.Form("Csign")
' response.write "<p>" & strDirector & "</p>"
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "members", strConnect, adOpenStatic, adLockReadOnly, adCmdTable
if len(strDirector) < 4 then
strCriteria = "Callid LIKE '" & strDirector & "*' "
else
strCriteria = "Callid = '" & strDirector & "' "
end if
objRS.Filter = strCriteria ' show the first relevant record
>From: "Eric Levine" <eric@d...>
>Reply-To: "Access ASP" <access_asp@p...>
>To: "Access ASP" <access_asp@p...>
>Subject: [access_asp] Search on whole words or Wildcards only
>Date: Thu, 2 May 2002 08:08:34 -0400
>
>Good morning,
>
>
>
>Anyone have an idea how I would go about creating the SQL necessary to
>only search only on complete words, multiple words or by wild card? In
>my current SQL statement, if someone were to simply put the letter 'a'
>in the text box, they would receive any and all items that contain the
>letter 'a'. In a real world scenario, if they wanted to see womens
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
|
|
 |