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

分页问题

cartaion 发布于 2012-11-15 19:05, 493 次点击
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
    dim conn
    set conn = server.createobject("ADODB.connection")
    conn.connectionstring="Provider = microsoft.ace.oledb.12.0;Data Source="&server.mappath("persondatabase.accdb")
    conn.open
        dim rs
        set rs = server.createobject("ADODB.recordset")
        rs.open "零件报价表",conn,1,1
%>
<html>
    <head>
        <title>分页技术</title>
        <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
        <style>
            *{ margin:0; padding:0; }
            body { font-szie:12px; color:#CC9900; font-family:"Times New Roman", Times, serif; background-color:#99CC66; }
            p { color:#000000; font-size:20px; }
            H6 { font-size:20px; font-weight:normal; text-align:center; }
            H6 a { padding:3px; text-decoration:none; color:#000000; }
            H6 a:hover { text-decoration:none; color:#FFCC00; }
            table { background-color:#99CC66; margin:10px auto; }
            table tr { background-color:#FFFF99; text-align:center;  }
            table tr th { font-size:14px; color:#FF0000; padding:10px;}
            table tr td { color:#CC9900; padding:10px;}   
        
        </style>
    </head>
    <body>               
        <%rs.pagesize=5%>
        <p><%=rs.pagecount%></p>
        <%rs.absolutepage=2%>
        <p><%=rs.absolutepage%></p>
        <H6><%
            for i=1 to rs.pagecount '这句代码原来是 do while not rs.eof 下面对应的是loop,现在做分页,换成for 语句之后错误提示下面的for 无效,是怎么回事
                response.write  "<a href='database_8.asp?page="&i&"'>"&i&"</a>"&"|"
            next
        %></H6>
        <table >
            <tr>
                <%
                    for i=0 to rs.fields.count-1
                %>
                <th><%=rs.fields(i).name%></th>
                <%
                    next
                %>
            </tr>
                <%
                    for i=0 to rs.pagesize
                %>
                    <tr>
                <%   
                    for i=0 to rs.fields.count-1
                %>               
                <td><%=rs.fields(i).value%></td>               
                <%
                        
                        next
                        rs.movenext
                %>
                </tr>
                <%
                   next                   
                %>            
        </table>
    </body>
</html>
<%
    conn.close
    set conn=nothing
%>

2 回复
#2
yms1232012-11-19 16:13
具体提示什么错误?而且你这个写法有很大问题
#3
cartaion2012-11-26 08:48
回复 2楼 yms123
有什么问题呀,这个问题提示缺少end
1