posts - 23, comments - 6, trackbacks - 0, articles - 0
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

两个表的双循环排列

Posted on 2006-09-18 14:29 小傻 阅读(227) 评论(0)  编辑  收藏 所属分类: asp

<TABLE >
 <% set rs=server.createobject("adodb.recordset")
 sql="select category.categoryid as id,category.categoryname as cname,classid,classname,classnumber from category,class where category.categoryid=class.categoryid order by category.sortnumber "
     rs.open sql,conn,1,1
       i=0
     while not rs.eof
       if i mod 3=0 then%>
 <TR>
          <%end if
    id=rs("id")
    id1=rs("id") %>
<TD vAlign=top>
<TABLE >
<tr>
<Td <%=trim(rs("cname"))%></A>
</Td>
</tr>

<tr>
<td>
<TABLE >
<%while not rs.eof and id1=id%>  
<TR>
<TD >
<%=rs("classname")%></TD>      
    </TR> 
      <%  rs.movenext
                if not rs.eof then
                 id1=rs("id")
                end if
             wend%>                            
</TABLE>
</TD>
</TR> 
</TABLE>
</TD>
    <% i=i+1
    if i mod 3=0 then%>
 </TR>
   <%end if
   wend%>


只有注册用户登录后才能发表评论。


网站导航: