注册 登录
编程论坛 ASP技术论坛

为什么只有第一项有二级菜单,其他的都显示不出来

关小彤 发布于 2008-12-10 20:19, 766 次点击
预想的效果是如下图,但是只有第一项中能够显示,其他的都不显示,不知道错在哪了
<%
Dim Sql1,Sql,Rs,Rs1
Sql="select * from category where ParentID=0 order by categoryid "
Set Rs=server.CreateObject("adodb.recordset")
Set Rs1=server.CreateObject("adodb.recordset")
Rs.open Sql,conn,3,3
If  Rs.eof Then
Response.Write("暂时无商品分类")
Else

%>
<table align="center" width="98%" >
<tr><td   colspan="4"  bgcolor="#6699CC">商品分类</td>
</tr>
<%
Do while not Rs.eof
categoryId=Rs("categoryId")
response.Write(categoryId)
%>
<tr height="25">
<td width="62%" background="images/titlebg.gif"><%=Rs("category")%></td>
<td width="12%" background="images/titlebg.gif">添加二级分类</td>
<td width="14%" background="images/titlebg.gif">编辑分类</td>
<td width="12%" background="images/titlebg.gif">删除分类 </td>
</tr>
        <%
    Sql1="select * from category where ParentID="&categoryId&""
    response.Write(sql1)
    Rs1.open Sql1,conn,3,3
    If  Rs1.eof Then
    Response.Write("暂时无二级菜单")
    Else
    Rs1.movefirst
    do while not Rs1.eof
    %>

<tr height="25">
<td width="62%" bgcolor="#CCCCCC" ><img src="images/crossicon.gif" /><%=Rs1("category")%></td>
<td width="12%"  bgcolor="#CCCCCC">添加二级分类</td>
<td width="14%" bgcolor="#CCCCCC">编辑分类</td>
<td width="12%" bgcolor="#CCCCCC">删除分类 </td>
</tr>
    <%
    Rs1.movenext
    Loop
    End If%>

<%
Rs.movenext
Loop
End If
%>

</table>
5 回复
#2
关小彤2008-12-11 11:47
怎么没人回答?:(
#3
孤独冷雨2008-12-11 17:30
好好看一下你的二级目录的SQL语句中的categoryId有值没有!可以RESPONSE.WRITE sql输出一下看一下值!
#4
关小彤2008-12-12 10:56
response.write sql语句是正确的,但是就是显示不出来:(
#5
孤独冷雨2008-12-12 16:34
Rs1.movefirst
去掉试一下!如果你的categoryId 是正确的就不会有问题的!
#6
luojia862008-12-13 12:42
1