TechnicalLoser
Technical User
I had a problem where I had a search page and from that page I could search two different catalogs(using radio buttons). The problem was the results from one page would work(it would only pull the records that matched) but the other results page on the other one would show all my records. After spending several hours looking for any differences between the two I noticed in the code of the one that worked the...
<% Dim (recordsetname)_MMColParam.....etc was before where Ultradev builds the recordset. And in the one that didn't work it was defining the MMColParam variable after my record set was built so it was building the recordset with all records, because the MMColParam part pulls the search variable from your search page. So I just cut and pasted the MMColParam part ahead of my where my recordset is built and PRESTO. Ultradev must have switched them around at sometime. Below is the code as it should look.
<%
Dim RESP__MMColParam
RESP__MMColParam = "1"
if (Request.QueryString("prodname"
<> ""
then RESP__MMColParam = Request.QueryString("prodname"
%>
<%
set RESP = Server.CreateObject("ADODB.Recordset"
RESP.ActiveConnection = MM_Beaverc_STRING
RESP.Source = "SELECT * FROM plant WHERE BIOL LIKE '%" + Replace(RESP__MMColParam, "'", "''"
+ "%' ORDER BY BIOL ASC"
RESP.CursorType = 0
RESP.CursorLocation = 2
RESP.LockType = 3
RESP.Open()
RESP_numRows = 0
%>
Now how it looked before(bad)
<%
set RESP = Server.CreateObject("ADODB.Recordset"
RESP.ActiveConnection = MM_Beaverc_STRING
RESP.Source = "SELECT * FROM plant WHERE BIOL LIKE '%" + Replace(RESP__MMColParam, "'", "''"
+ "%' ORDER BY BIOL ASC"
RESP.CursorType = 0
RESP.CursorLocation = 2
RESP.LockType = 3
RESP.Open()
RESP_numRows = 0
%>
<%
Dim RESP__MMColParam
RESP__MMColParam = "1"
if (Request.QueryString("prodname"
<> ""
then RESP__MMColParam = Request.QueryString("prodname"
%>
Hope this helps someone.
<% Dim (recordsetname)_MMColParam.....etc was before where Ultradev builds the recordset. And in the one that didn't work it was defining the MMColParam variable after my record set was built so it was building the recordset with all records, because the MMColParam part pulls the search variable from your search page. So I just cut and pasted the MMColParam part ahead of my where my recordset is built and PRESTO. Ultradev must have switched them around at sometime. Below is the code as it should look.
<%
Dim RESP__MMColParam
RESP__MMColParam = "1"
if (Request.QueryString("prodname"
%>
<%
set RESP = Server.CreateObject("ADODB.Recordset"
RESP.ActiveConnection = MM_Beaverc_STRING
RESP.Source = "SELECT * FROM plant WHERE BIOL LIKE '%" + Replace(RESP__MMColParam, "'", "''"
RESP.CursorType = 0
RESP.CursorLocation = 2
RESP.LockType = 3
RESP.Open()
RESP_numRows = 0
%>
Now how it looked before(bad)
<%
set RESP = Server.CreateObject("ADODB.Recordset"
RESP.ActiveConnection = MM_Beaverc_STRING
RESP.Source = "SELECT * FROM plant WHERE BIOL LIKE '%" + Replace(RESP__MMColParam, "'", "''"
RESP.CursorType = 0
RESP.CursorLocation = 2
RESP.LockType = 3
RESP.Open()
RESP_numRows = 0
%>
<%
Dim RESP__MMColParam
RESP__MMColParam = "1"
if (Request.QueryString("prodname"
%>
Hope this helps someone.