双循环问题
<%sql="Select * From ["&TablePrefix&"Forums] where GroupID="&GroupGetRow(0,j)&" and ForumID<>22 and ForumID<>2 and ParentID=0 and SortOrder>0 and IsActive=1 order by SortOrder"
Set Rs=Execute(sql)%>
<table width="980" style=" border-top:1px solid #;border-left:1px solid #0767A6; border-right:1px solid #0767A6; border-bottom:1px solid #0767A6;">
<%
dim i2, s2, j2
i2 = 0
s2 = ""
do while not Rs.eof
if i2 mod 2 = 0 then
%>
<tr>
<%end if%>
<td background="Images/ks_tit_bg2.gif" height="31" width="490"> <a href="<%=ForumUrlStr%>"><span class="STYLE9"><%=Rs("ForumName")%></span></a><!-- <%=TodayPostsHtml%><br /><%=BBCode(Rs("ForumDescription"))%><%=SubForumStrings%>--></td>
<%
if i2 mod 2 = 1 then%>
</tr>
<%else
if i2 = Rs.RecordCount-1 Then
For j2 = 1 To 1-i2
s2 = s2 & "<td></td>"
Next
s2 = s2 & "</tr>"
response.write s2
end if
end if
i2=i2+1%>
<%
Rs.Movenext
loop%>
</table>
假如Rs("ForumName")为:企业介绍,新闻动态,服务项目、成功案例
那么上面的代码则显示为
企业介绍 新闻动态
服务项目 成功案例
请问怎么做能够在Rs("ForumName")下面再加上一个循环,如下:
<%sql1="Select * From ["&TablePrefix&"Threads] where ForumName="&rs("ForumName")&""
Set Rs1=Execute(sql1)%>
企业介绍 新闻动态
<%do while not Rs1.eof%> <%do while not Rs1.eof%>
rs1("Topic") rs1("Topic")
<%Rs.Movenext <%Rs.Movenext
loop%> loop%>
服务项目 成功案例
<%do while not Rs1.eof%> <%do while not Rs1.eof%>
rs1("Topic") rs1("Topic")
<%Rs.Movenext <%Rs.Movenext
loop%>
------解决方案--------------------
<td background="Images/ks_tit_bg2.gif" height="31" width="490"> <a href="<%=ForumUrlStr%>"><span class="STYLE9"><%=Rs("ForumName")%></span></a><!-- <%=TodayPostsHtml%><br /><%=BBCode(Rs("ForumDescription"))%><%=SubForumStrings%>-->
<br />
<%sql1="Select * From ["&TablePrefix&"Threads] where ForumName="&rs("ForumName")&""
Set Rs1=Execute(sql1)
do while not Rs1.eof%>
response.write(rs1("Topic")+"<br />")
Rs.Movenext
loop%>
</td>