i'm trying to build a search engine that seeks keywords from the DB.
When i enter just one word, this script works fine, but when i enter
two or more words, i get a syntax error. pls help me correct this
script.
For i = 1 to WordCounter
If SType = "AllWords" Then
If i <> WordCounter Then
strSQL1 = strSQL1 & " LIKE '%" & Word(i) & "%' AND "
ElseIf i = WordCounter Then
strSQL1 = strSQL1 & " LIKE '%" & Word(i) & "%' "
End If
ElseIf SType = "AnyWord" Then
If i <> WordCounter Then
strSQL1 = strSQL1 & " LIKE '%" & Word(i) & "%' OR "
ElseIf i = WordCounter Then
strSQL1 = strSQL1 & " LIKE '%" & Word(i) & "%' "
End If
End If
Next
strSQL = "SELECT * FROM articles WHERE Keywords" & strSQL1 & " ORDER
BY ArticleDate DESC"
When i use two or more words, i get this error:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression 'Keywords LIKE
'%trade%' AND LIKE '%agriculture%''.
/owinfs/tests/searchalltry.asp, line 175
Thank you.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/