当前位置: 代码迷 >> ASP >> 大家看看小弟我这分页代码有没有出错
  详细解决方案

大家看看小弟我这分页代码有没有出错

热度:123   发布时间:2012-02-12 17:16:33.0
大家看看我这分页代码有没有出错?
<%@LANGUAGE= "VBSCRIPT "   CODEPAGE= "936 "%>
<!--#include   file= "conn.asp "-->
<%
set   rs=server.createobject( "adodb.recordset ") '使用记录集组件创建记录集
cx= "select   name,qq,email,ly,time   from   liuyan   order   by   id   desc " '建立查询变量,查询表中的字段,顺序为倒序,即反顺序,此处不能有空格
rs.open   cx,conn,1,1 '打开记录集,进行读取
%>
<%rs.pagesize=3 '使用recordset记录中的pagesize(页面显示的记录数)属性来确定每页显示几条记录
suoyouye=rs.pagecount '查询记录集中的页数
page=int(request( "page ")) '将PAGE变量   转换为整数
if   page <=0   then   page=1 '如果页数等于小于零那么设定此页等于1
if   request( "page ")= " "   then   page=1 '如果页数等于空,那么仍旧蛇定此页等于1
rs.absolutepage=page '指定当前记录在哪一页。pagesize、pagecount、absolutpage均为recordset的属性
%>
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN "   "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> 无标题文档 </title>
<style   type= "text/css ">
<!--
.style1   {font-size:   12px}
.style2   {
font-size:   14px;
color:   #FF0000;
}
-->
</style>
</head>

<body>
<%if   rs.eof   and   rs.bof   then
response.write   "还没有文章 "
else
for   i=1   to   rs.pagesize%>
<div   align= "center ">
    <table   width= "543 "   height= "80 "   border= "1 "   cellpadding= "0 "   cellspacing= "0 "   bordercolor= "#006633 ">
        <tr>
            <td   width= "369 "   height= "23 "> <table   width= "369 "   border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
                    <tr>
                        <td   height= "23 "   bgcolor= "#00CCCC ">   <div   align= "left "> <span   class= "style1 "> 留言人 </span> :
                                <%response.write   rs( "name ")%>  
             <span   class= "style1 "> 留言时间 </span> :
            <%response.write   rs( "time ")%>
                        </div> </td>
                    </tr>
            </table> </td>
            <td   width= "84 "> <table   width= "84 "   border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
                <tr>
                    <td   height= "23 "   bgcolor= "#009966 "> <div   align= "center "> <a   href= "http://search.tencent.com/cgi-bin/friend/user_show_info?ln= <%=rs( "qq ")%> "   target= "_blank "   class= "style1 "> QQ </a> </div> </td>
  相关解决方案