Help needed to create nested do while
Hello,
I am trying to print a record set information that looks like:
TheaterID, MoviedID, MovieTitle (ordered in similar fashion)
1, 50, a
1, 51, b
1, 52, c
2, 53, d
2, 50, a
3, 54, e
3, 55, f
The outer loop is driven by the condition while not rs.eof. I am performing a similar while loop inside the outer loop to loop through all the MovieTitle contolled by TheaterID. I run into problem when TheaterID changes there by a record in the process of rs.movenext. How can I write the inner loop so that I can print all the MovieTitle for each of the TheaterID? Below is the snippet of code that I have created.
rs.Open mySQL, cn, adOpenDynamic
Dim n
Do while Not rs.eof
n = rs.Fields("TheaterID").value
%>
<tr>
<td width="100%" bgcolor="#CDD9AB">
<p align="center" class="Sface"><b><%=rs.Fields("TheaterName").value %></b><br>
</td>
</tr>
<%
Do while rs.Fields("TheaterID").value = n
%>
<tr bgcolor="#EFF3E4">
<td valign="top" width="39%" class="Sface"><A class="face" href="/Movies/View.asp?MovieID=<%=rs.Fields("MovieID").value %>"><%=rs.Fields("MovieTitle").value %></A></td>
</tr>
<%
Rs.movenext
Loop
%>
</table>
</td>
</tr>
<%
Rs.movenext
Loop
%>
How best can this scenario be coded? All help is appreciated. Thanks.
Paul
|