SELECT * FROM articles WHERE Keywords LIKE
  '%agriculture%' AND LIKE '%news%' ORDER BY ArticleDate,  DESC 

ah in Access it is a * not a %

  SELECT * FROM articles WHERE Keywords LIKE
  '*agriculture*' AND LIKE '*news*' ORDER BY ArticleDate,  DESC 

would be correct I believe.

On Apr 3, 2005 10:55 PM, flor bamboo <[EMAIL PROTECTED]> wrote:
>  This is the sql statement that came out:
>  
>  SELECT * FROM articles WHERE Keywords LIKE
>  '%agriculture%' AND LIKE '%news%' ORDER BY ArticleDate
>  DESC 
> 
>  
>  
>  --- Charles Carroll <[EMAIL PROTECTED]> wrote:
>  > You must tell us the exact SQL that occured after
>  > the IFs and etc. ran
>  > by response.writing it ala
>  > http://www.learnasp.com/learn/sqlwrite.asp
>  > Tell us what the full string is that it was getting
>  > error on.
>  > 
>  > On Apr 3, 2005 10:07 PM, floorbamboo
>  > <[EMAIL PROTECTED]> wrote:
>  > >  
>  > >  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 the Yahoo!
>  > Terms of Service.
>  > 
>  
> ________________________________________________________________________
>  Yahoo! Messenger - Communicate instantly..."Ping" 
>  your friends today! Download Messenger Now 
>  http://uk.messenger.yahoo.com/download/index.html
>  
>  
>  ________________________________
>  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 the Yahoo! Terms of Service.


 
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/
 



Reply via email to