数据分行(任意)输出的两种方法 (不错喽)

类别:Asp 点击:0 评论:0 推荐:

<!-- #include file="connect.asp" -->
         <%
            'set rs=server.CreateObject("adodb.recordset")  /. Rs在connect.asp在有定义
            sql="select * from 试卷信息"
            rs.open sql,conn,1,1
         %>

++++++++++++++ 方法一 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
         <table width="245" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF">
            <tr>
            <%
             j=0
            do while not rs.eof
            j=j+1  %>
            <td>
            <% =rs("试卷名称")%></td>
            <% if (j mod 2=0) and j>=2 then %>
           </tr><tr>
            <% end if
               rs.movenext
               loop%></tr>
            </table>
++++++++++++++ 方法二 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
    <table width="245" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF">
           <% do while not rs.eof %>
           <tr>
            <td><% =rs("试卷名称")%></td>
            <%
              rs.movenext
              k=k+1
              if k>5 then exit do
            %>
            <td><% =rs("试卷名称")%></td></tr>
           <%
              k=k+1
              if k>5 then exit do
              rs.movenext
              loop%>
           </table>

本文地址:http://com.8s8s.com/it/it7840.htm