Forums

This topic is locked

NEED Help on T Cubed Adv Search

Posted 30 May 2001 21:21:57
1
has voted
30 May 2001 21:21:57 Kelly Brady posted:
Here is the problem. I have created a search page using the
T-Cubed
advanced search
Behavior written by Tom Steeper I have tried to email him regarding the issue but he must be to busy for me.
I am trying to add a few enhancements to this search by adding another variable. I have revised the query string to search for two things. The words presented in the search and another passed variable. It works however when I implement the GO TO Navigation Server behavior NEXT I receive the following error.

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'AND'.
/garlock/internet/adv_search_results.asp, line 49

Line 49 is the one below highlighted in red bold
<%
Dim CompType, t3_advSearch_String
'Store type of query in CompType ie All Words/OR, Any Word/AND or Exact Phrase/EXACT
CompType = Request("CompType"
SearchColumn = "FAQ_KEYWORDS"

SearchField = "all"
if(Request("SearchParam" <> "" then SearchField = Request("SearchParam"
'Remove any single quotes from search field to eliminate potential errors.
SearchField = Replace(SearchField, "", ""

'Checks the CompType, Executes this code if the option All words or Any Word is chosen
if(CompType <> "EXACT" then
t3_advSearch_String = " AND " & SearchColumn & " LIKE '%"
'Splits the search criteria into seperate words and stores them in an Array
SearchArray=Split(SearchField," "
for i = 0 to Ubound(SearchArray)
if i > 0 then
'Builds the sql statement using the CompType to substitute AND/OR
t3_advSearch_String = t3_advSearch_String & " " & CompType & " " & SearchColumn & " LIKE '%"& SearchArray(i) & "%'"
else
'Ends the sql statement if there is only one word
t3_advSearch_String = t3_advSearch_String & SearchArray(i) & "%'"
end if
next

else
t3_advSearch_String = " AND " & SearchColumn & " LIKE '%" & SearchField & "%'"
end if
%>
<%
Dim category_id
category_id = Request.Form("FAQ_CATEGORY_ID"
%>
<%
Dim rsSearch__t3_String
' rsSearch__t3_String = "WHERE FAQ_CATEGORY_ID=2"
if (t3_advSearch_String <> "" then rsSearch__t3_String = t3_advSearch_String
%>
<%
set rsSearch = Server.CreateObject("ADODB.Recordset"
rsSearch.ActiveConnection = MM_garlock_STRING
rsSearch.Source = "SELECT * FROM FAQ WHERE FAQ.FAQ_CATEGORY_ID = " & category_id & + Replace(rsSearch__t3_String, "'", "'" + ""
rsSearch.CursorType = 0
rsSearch.CursorLocation = 2
rsSearch.LockType = 3
Line 49) rsSearch.Open()
rsSearch_numRows = 0
%>

I know that the error is relating to the SQL statement and being that it has been revised I would still be looking for any advise as to how to perform this search properly involving not just for the SearchColumn to be looked at but also the
category_id = Request.Form("FAQ_CATEGORY_ID"
to be a part of the search.

Also need to have the GO TO Next work!!! HELP


Any help from anybody would definitely be of great appreciation. I have been stumped to long on this and please forgive me for my apparent ignorance. Thanks People


Replies

Replied 02 Jun 2001 07:28:35
02 Jun 2001 07:28:35 frog jumps replied:
I have ran into the same thing with a details page link....work around is to design everything normally and THEN apply the extension and code tweaks...works for me, but u can try it...

If u r livin' on the edge, then u r not livin'...jump!

Reply to this topic