Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

Search in more than two tblFields - using strings?

Posted 19 Apr 2002 16:21:38
1
has voted
19 Apr 2002 16:21:38 Garo Maka posted:
upps... Lets say you want the textfield to search in more than two table fields using strings.
Can this be done in the same code?

IF Request("txtKeywords" <>"" Then
AndtxtKeywordsString = " AND LINK_NAME LIKE '%" & Request("txtKeywords" & "%' OR LINK_DESC LIKE '%" & Request("txtKeywords" & "%' OR LINK_URL LIKE '%" & Request("txtKeywords" & "%'"
Else
AndtxtKeywordsString = ""
End If

The results returns any LINK_URL that contains the search word, not filtering it acconrding to KATEGORI and AMT.

Here is the whole code...

<%
varWhereString = "WHERE LINK_ID <> -1 "

IF Request("selCat" <>"" Then
AndCatString = " AND KATEGORI LIKE '%" & Request("selCat" & "%'"
Else
AndCatString = ""
End If

IF Request("selAmt" <>"" Then
AndAmtString = " AND AMT LIKE '%" & Request("selAmt" & "%'"
Else
AndAmtString = ""
End If

IF Request("txtKeywords" <>"" Then
AndtxtKeywordsString = " AND LINK_NAME LIKE '%" & Request("txtKeywords" & "%' OR LINK_DESC LIKE '%" & Request("txtKeywords" & "%' OR LINK_URL LIKE '%" & Request("txtKeywords" & "%'"
Else
AndtxtKeywordsString = ""
End If

varWhereString = varWhereString & AndCatString & AndAmtString & AndtxtKeywordsString & " ORDER BY LINK_NAME ASC"
%>
<%
set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_connDezzPortal_STRING
Recordset1.Source = "SELECT * FROM LINKS " &varWhereString
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>

If you know if its posible and how, please give me a hand

Thanks

Reply to this topic