想问一下大家就是关于while嵌套循环的问题
大家好,想请教一下大家就是,现在我有两个表先从大类表里面吧大类明先循环查出来,然后在在大类循环里面再从商品表力循环查处等于大类名的记录,但是我做的老是错希望高手指教,下面是我的程序:<table width="950" height="5" border="0" cellpadding="0" cellspacing="0">
<tr>
<td></td>
</tr>
</table>
<table height="343" cellspacing="0" cellpadding="0" width="950" align="center" border="0">
<tbody>
<tr>
<td width="10" height="343" valign="top"> </td>
<td valign="top" width="224"><!--#include file="left_pinpai.asp"--></td>
<td valign="top" width="27"> </td>
<td valign="top" width="689"><table cellspacing="0" cellpadding="0" width="689" border="0">
<tbody>
<tr>
<td width="689" valign="top"><img height="61" src="images/t_1.gif"
width="689" /></td>
</tr>
<tr>
<td height="207" align="left" valign="top" bgcolor="#efefef" class="zi"><TABLE width="660" height="148" border=0 align="center" cellPadding=0 cellSpacing=0>
<TBODY>
<%
dim rszhongcai,sqlzhongcai
sqlzhongcai="select * from smallclass order by smallclassID desc"
set rszhongcai=conn.execute(sqlzhongcai)
if rszhongcai.eof or rszhongcai.bof then
response.Write("暂时没有记录")
else
%>
<TR>
<%
i=0
do while not rszhongcai.eof
i=i+1
%>
<TD width=647 valign="top"><TABLE width=305 border=0 cellPadding=0 cellSpacing=0 bgcolor="#FFFFFF">
<TR>
<TD width=6 height=6><IMG height=6
src="images/new_box02_top_left.gif"
width=6></TD>
<TD
background="images/new_box02_top_bg.gif"><IMG
height=1 src="" width=1></TD>
<TD width=6 height=6><IMG height=6
src="images/new_box02_top_right.gif"
width=6></TD>
</TR>
<TR>
<TD width=6
background="images/new_box02_left_bg.gif"></TD>
<TD vAlign=top><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width="9%"
background="images/topicbg.gif"
bgColor=#ffffff height=25><DIV align=center><IMG height=20
src="images/bar1.gif"
width=20> </DIV></TD>
<TD class=style4 width="74%"
background="images/topicbg.gif"
bgColor=#ffffff><B class="g"><%=rszhongcai("smallclassname")%></B> </TD>
<TD width="17%" align="center"
background="images/topicbg.gif"
bgColor=#ffffff><a href="g4-ny.htm"><IMG
src="images/more.gif"
width=44 height=11 border="0"></a></TD>
</TR>
<TR>
<TD colSpan=3><IMG height=1 src="" width="100%"></TD>
</TR>
<TR vAlign=top>
<TD colSpan=3><TABLE
width="100%" height=70 border=0 cellPadding=0 cellSpacing=0 bgcolor="#FFFFFF">
<TBODY>
<TR>
<TD width="37%"><TABLE cellSpacing=5 cellPadding=0 width="100%"
align=center border=0>
<TBODY>
<TR vAlign=top>
<TD align=middle><IMG class=pic3 height=70
src="<%=rszhongcai("DefaultPicUrl")%>"
width=100
border=0></TD>
</TR>
</TBODY>
</TABLE></TD>
<TD width="63%" valign="top"><TABLE width="100%" cellPadding=0 cellSpacing=0 class="zi">
<%
dim rsproduct,sqlproduct
sqlproduct="select * from product where smallclassname="&rszhongcai("smallclassname")
set rsproduct=conn.execute(sqlproduct)
do while not rsproduct.eof
%>
<TR>
<TD width=18 align="center" vAlign=middle class=""><IMG
src="images/Photo_common.gif" alt=普通图片 width="7" height="7"></TD>
<TD width="163" class=""><%=rsproduct("title")%></TD>
</TR>
<%
rsproduct.movenext
loop
%>
</TABLE></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
</TBODY>
</TABLE></TD>
<TD width=6
background="images/new_box02_right_bg.gif"></TD>
</TR>
<TR>
<TD><IMG height=6
src="images/new_box02_bottom_left.gif"
width=6></TD>
<TD
background="images/new_box02_bottom_bg.gif"><IMG
height=1 src="" width=1></TD>
<TD><IMG height=6
src="images/new_box02_bottom_right.gif"
width=6></TD>
</tr>
</TABLE></TD>
<%
if i mod 2=0 then
response.Write("<tr>")
end if
rszhongcai.movenext
loop
end if
rszhongcai.close
set rszhongcai=nothing
conn.close
set conn=nothing
%>
</TBODY>
</TABLE></td>
</tr>
<tr>
<td valign="top"><img height="11" src="images/company_13.jpg"
width="689" /></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
<table width="950" height="10" border="0" cellpadding="0" cellspacing="0">
<tr>
<td></td>
</tr>
</table>
<!--#include file="foot.asp"--></td>
</tr>
</table>
下面是效果:
其中黄字是大类名
灰字是商品表力的信息