Multiple word search

Results 1 to 2 of 2

Thread: Multiple word search

  1. #1
    Barkus Guest

    Default Multiple word search

    Need some help with this one!!!<BR><BR>Does anyone know how to do a multiple query for keywords.<BR><BR><BR>Example: In my database there is a file that contains the following text. "I need help with ASP"<BR><BR> Keyword: Help ASP (Gets nothing)<BR> Keyword: Help with ASP (Gets a hit)<BR><BR>Please help<BR><BR>

  2. #2
    Robert Hoonjan Guest

    Default RE: Multiple word search

    You need to break up your text to search into seperate items<BR>and submit them as part of an sql string: Pseudo code follows, untested but should give you an idea of how to get it going<BR><BR><BR>First Create an array<BR><BR>Parse the string storing each word of the search into the array using a loop and instr/mid functions<BR><BR>Create the sql statement example code below where FieldToSearch is the field in the table you are searching and Mytable is the name of the table within the database<BR><BR>do the query<BR><BR><BR>sqlCriteria = ""<BR><BR>For Loop = 0 to Ubound(array)<BR> NewItem = "FieldToSearch = &#039" & array(Loop) & "&#039"<BR> If Len(SqlCriteria) &#062; 0 Then<BR> JoinStatement = " OR "<BR> Else<BR> JoinStatement = ""<BR> End if <BR> SqlCriteria = SqlCriteria & JoinStatement & NewItem<BR>Next<BR> <BR><BR>SqlQuery = "Select * From MyTable Where " & SqlCriteria<BR><BR><BR><BR>Hope that helps<BR><BR>Robert<BR>

Posting Permissions

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