关键字分解查询?!难....
假若我在文本框中输入 "1 2" 注意,中间有空格, 表示我即可以找到和"1" 有关的字段,又可以找到和"2" 有关的字段,这样应该怎么实现 :
-------(参考)以下的一段代码检索的时候速度慢.... 我什么好方法吗?!
' 搜索Keywords字段
QueryString = Request.form( "QueryString" )
QueryWords = Split( QueryString )
sql = sql & " ) OR ( [Keywords] LIKE '%" & QueryWords( 0 ) & "%'"
For i = LBound( QueryWords ) + 1 to UBound( QueryWords )
If QueryWords( i ) <> "" and UCase( QueryWords(i) ) <> "OR" and UCase( QueryWords(i) ) <> "AND" Then
If uCase( QueryWords( i-1 ) ) = "OR" Then
sql = sql & " OR [Keywords] LIKE '%" & QueryWords( i ) & "%'"
Else
sql = sql & " AND [Keywords] LIKE '%" & QueryWords( i ) & "%'"
End If
End If
Next
----------