I've been staring at this for sometime and think it's time to pull back for a few and maybe ask for alittle help if anyone can spare a few seconds. I can't seem to get this code working:
<%
Session("frmSearch")=Request("txtSearch")
Session("frmSearchSize")= Len(Request("txtSearch"))
Session("SearchCategory") = 4
If Session("frmSearchSize") < 1 Then
Response.Redirect(" Else
Dim strAryWords(8)
Dim wordcount
Dim objConn, objRs, qry
Dim connectstr, sDSNDir
Dim dsn_name
dsn_name = "mysql_mgssearch.dsn"
sDSNDir = Server.MapPath("_dsn")
connectstr = "filedsn=" & sDSNDir & "\" & dsn_name
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open connectstr
qry = "SELECT * FROM DictMast WHERE SearchTerms = '" & Session("frmSearch") & "'"
Set objRs = objConn.Execute(qry)
if not objRs.EOF then
Session("SearchCategory") = objRs("MainCat")
else
Set objRs = nothing
wordcount = 0
if ( InStr(Session("frmSearch"), " ") <> Null ) AND ( InStr(Session("frmSearch"), " ") <> 0 )
strAryWords = Split(Session("frmSearch"), " ")
else
strAryWords(0) = Session("frmSearch")
end if
while ( Ubound(strAryWords) -1 ) >= wordcount
qry = "SELECT * From DictMast WHERE SearchTerms = '" & strAryWords(wordcount) & "'"
Set objRs = objConn.Execute(qry)
if not objRs.EOF then
Session("SearchCategory") = objRs("MainCat")
wordcount = 999
end if
wordcount = wordcount + 1
wend
end if
Set objRs = nothing
qry = "SELECT * From Affiliates Where MainCat=" & Session("SearchCategory")
Set objRs = objConn.Execute(qry)
End If
%>
Errol Barratt
<%
Session("frmSearch")=Request("txtSearch")
Session("frmSearchSize")= Len(Request("txtSearch"))
Session("SearchCategory") = 4
If Session("frmSearchSize") < 1 Then
Response.Redirect(" Else
Dim strAryWords(8)
Dim wordcount
Dim objConn, objRs, qry
Dim connectstr, sDSNDir
Dim dsn_name
dsn_name = "mysql_mgssearch.dsn"
sDSNDir = Server.MapPath("_dsn")
connectstr = "filedsn=" & sDSNDir & "\" & dsn_name
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open connectstr
qry = "SELECT * FROM DictMast WHERE SearchTerms = '" & Session("frmSearch") & "'"
Set objRs = objConn.Execute(qry)
if not objRs.EOF then
Session("SearchCategory") = objRs("MainCat")
else
Set objRs = nothing
wordcount = 0
if ( InStr(Session("frmSearch"), " ") <> Null ) AND ( InStr(Session("frmSearch"), " ") <> 0 )
strAryWords = Split(Session("frmSearch"), " ")
else
strAryWords(0) = Session("frmSearch")
end if
while ( Ubound(strAryWords) -1 ) >= wordcount
qry = "SELECT * From DictMast WHERE SearchTerms = '" & strAryWords(wordcount) & "'"
Set objRs = objConn.Execute(qry)
if not objRs.EOF then
Session("SearchCategory") = objRs("MainCat")
wordcount = 999
end if
wordcount = wordcount + 1
wend
end if
Set objRs = nothing
qry = "SELECT * From Affiliates Where MainCat=" & Session("SearchCategory")
Set objRs = objConn.Execute(qry)
End If
%>
Errol Barratt