Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting all records on result page

Status
Not open for further replies.

TechnicalLoser

Technical User
Nov 19, 2001
26
0
0
CA
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 = &quot;1&quot;
if (Request.QueryString(&quot;prodname&quot;) <> &quot;&quot;) then RESP__MMColParam = Request.QueryString(&quot;prodname&quot;)
%>
<%
set RESP = Server.CreateObject(&quot;ADODB.Recordset&quot;)
RESP.ActiveConnection = MM_Beaverc_STRING
RESP.Source = &quot;SELECT * FROM plant WHERE BIOL LIKE '%&quot; + Replace(RESP__MMColParam, &quot;'&quot;, &quot;''&quot;) + &quot;%' ORDER BY BIOL ASC&quot;
RESP.CursorType = 0
RESP.CursorLocation = 2
RESP.LockType = 3
RESP.Open()
RESP_numRows = 0
%>


Now how it looked before(bad)
<%
set RESP = Server.CreateObject(&quot;ADODB.Recordset&quot;)
RESP.ActiveConnection = MM_Beaverc_STRING
RESP.Source = &quot;SELECT * FROM plant WHERE BIOL LIKE '%&quot; + Replace(RESP__MMColParam, &quot;'&quot;, &quot;''&quot;) + &quot;%' ORDER BY BIOL ASC&quot;
RESP.CursorType = 0
RESP.CursorLocation = 2
RESP.LockType = 3
RESP.Open()
RESP_numRows = 0
%>
<%
Dim RESP__MMColParam
RESP__MMColParam = &quot;1&quot;
if (Request.QueryString(&quot;prodname&quot;) <> &quot;&quot;) then RESP__MMColParam = Request.QueryString(&quot;prodname&quot;)
%>


Hope this helps someone.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top