Forums

ASP

This topic is locked

Nested Repeat Region Question

Posted 11 Dec 2008 03:03:39
1
has voted
11 Dec 2008 03:03:39 Dan B posted:
Hi everyone,

I have a question on whether or not something can be done, regarding a record I would like to have repeat within a recordset.
Here is a link to the page I will be talking about: 67.199.102.198/findit/

On this page, there is a list of MAIN categories, then SUB categories and then BUSINESSES in each resulting SUB category.
So, this list is generated based on active MAIN and SUB Categories, and then, based on the recordset I have created, I can get it to pull the First BUSINESS record, which is show in Light Blue (ie. Arts & Entertainment (MAIN) - Museums (SUB) - The Galt (BUSINESS)

What I am trying to do is have all of the active BUSINESS records to repeat in this loop.

HERE IS THE CODE for the recordset: (after this is the code on the page)

--- THIS IS THE CODE FOR THE MAIN CATEGORY ---
<%
Dim RS_Cat
Dim RS_Cat_cmd
Dim RS_Cat_numRows

Set RS_Cat_cmd = Server.CreateObject ("ADODB.Command"
RS_Cat_cmd.ActiveConnection = MM_ll_main_STRING
RS_Cat_cmd.CommandText = "SELECT * FROM tblBusCat ORDER BY BusCatName ASC"
RS_Cat_cmd.Prepared = true

Set RS_Cat = RS_Cat_cmd.Execute
RS_Cat_numRows = 0
%>

--- THIS IS THE CODE FOR THE AREA ON THE PAGE THAT THIS ALL HAPPENS, which includes the Recordset for the SUBCAT ---

<% While ((Repeat4__numRows <> 0) AND (NOT RS_Cat.EOF))%><%
Dim RS_Sub2__MMColParam
RS_Sub2__MMColParam = "1"
If ((RS_Cat.Fields.Item("BusCatID".Value) <> "" Then
RS_Sub2__MMColParam = (RS_Cat.Fields.Item("BusCatID".Value)
End If
%>
<%
Dim RS_Sub2
Dim RS_Sub2_numRows

Set RS_Sub2 = Server.CreateObject("ADODB.Recordset"
RS_Sub2.ActiveConnection = MM_ll_main_STRING
RS_Sub2.Source = "SELECT * FROM tblBusSubCat AS Sub, tblBusinessPages AS Bus WHERE Sub.busCatID = " + Replace(RS_Sub2__MMColParam, "'", "''" + " AND Sub.busSubCatID = Bus.busSubCatID AND Bus.bPageActive = True ORDER BY Sub.busSubCatName ASC"
RS_Sub2.CursorType = 1
RS_Sub2.CursorLocation = 2
RS_Sub2.LockType = 1
RS_Sub2.Open()

RS_Sub2_numRows = 0
%>
<% If Not RS_Sub2.EOF Or Not RS_Sub2.BOF Then %>
<%
RS_Sub2.MoveLast
VarLastRecord = RS_Sub2.Fields.Item("busSubCatID".Value
%>
<%
RS_Sub2.MoveFirst
%> <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td colspan="2"><img src="images/spacer.gif" alt="" width="10" height="10" /></td></tr>
<tr><td width="2%"><img src="images/spacer.gif" alt="" width="10" height="10" /></td><td width="98%" align="left"><table width="97%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="47" rowspan="2" valign="top" class="Blue11"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="business/bus_cat.asp?<%= Server.HTMLEncode(MM_keepNone) & MM_joinChar(MM_keepNone) & "BusCatID=" & RS_Cat.Fields.Item("BusCatID".Value %>"><img src="images/<%=(RS_Cat.Fields.Item("BusImage".Value)%>" alt="" border="0" /></a></td>
<td><img src="images/spacer.gif" alt="" width="10" height="25" /></td>
</tr>
</table></td>
<td colspan="2" align="left" class="Blue11"><strong><a href="business/bus_cat.asp?<%= Server.HTMLEncode(MM_keepNone) & MM_joinChar(MM_keepNone) & "BusCatID=" & RS_Cat.Fields.Item("BusCatID".Value %>" class="Blue14Bold"><%=(RS_Cat.Fields.Item("BusCatName".Value)%></a></strong></td>
</tr>
<tr>
<td width="533" align="left" class="Blue11"><img src="images/spacer.gif" alt="" width="10" height="5" /><br />
<%
<!--
VarSub = "blaBla"
-->
%>
<% While (Not RS_Sub2.EOF) AND (VarSubCount <> 0)%>
<%If NOT (RS_Sub2.Fields.Item("busSubCatID".Value) = VarSub Then %>
<table width="522" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="522">- <a href="business/bus_sub.asp?<%= Server.HTMLEncode(MM_keepNone) & MM_joinChar(MM_keepNone) & "busSubCatID=" & RS_Sub2.Fields.Item("busSubCatID".Value %>" class="GreyArial14"><%=(RS_Sub2.Fields.Item("busSubCatName".Value)%></a><img src="images/spacer.gif" alt="" width="10" height="10" /><span class="Blue10"><a href="business/bus_detail.asp?<%= Server.HTMLEncode(MM_keepNone) & MM_joinChar(MM_keepNone) & "bPageID=" & RS_Sub2.Fields.Item("bPageID".Value %>" class="Blue10"><%=(RS_Sub2.Fields.Item("bPageName".Value)%></a></span></td>
</tr>
<tr>
<td><img src="images/spacer.gif" alt="" width="10" height="5" /></td>
</tr>
</table>
<%If NOT (RS_Sub2.Fields.Item("busSubCatID".Value) = VarLastRecord Then %>
<% End If %>
<% End If %>
<%
<!--
VarSub = RS_Sub2.Fields.Item("busSubCatID".Value
-->
%>
<%
<!--
VarSubCount = VarSubCount-1
-->
%>
<% RS_Sub2.MoveNext
Wend
%><%
<!--
VarSubCount = 50
-->
%>
<img src="spacer.gif" width="10" height="5" /></td>
<td width="21" align="left" valign="top" class="Blue11"> </td>
</tr></table></td></tr></table><img src="images/bottom.gif" width="625" height="14" /><% End If ' end Not RS_Sub2.EOF Or NOT RS_Sub2.BOF %>
<% Repeat4__index=Repeat4__index+1
Repeat4__numRows=Repeat4__numRows-1
RS_Cat.MoveNext()
Wend
%>



SO.......... What i'm trying to do is just repeat ALL of the active BUSINESSES, which are "bPageName".

Can this be done? If so, what do I have to do?

Thanks in advance<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> Happy Holidays!

Dan.

Replies

Replied 06 Mar 2012 11:25:47
06 Mar 2012 11:25:47 bric eauc replied:
Thanks.......
On this page, there is a list of MAIN categories, then SUB categories and then BUSINESSES in each resulting SUB category.
Replied 21 Jun 2012 15:34:06
21 Jun 2012 15:34:06 Ronny Davis replied:
yes I applied it into my .ASP page and get a loop of blocks.
check it
Wine Coasters Printing

Reply to this topic