当前位置: 首页 > 图文教程 > 网络编程 > ASP > asp 简单分页代码

ASP
asp中缓存cache技术的应用
escape解决AJAX中文乱码的简单方法
提高asp程序访问速度的方法
17个ASP编程基础典型代码
用asp编写类似搜索引擎功能的代码
ASP-server.URLEncode反函数:urldecode
判断远程图片是否存在的asp技巧
ASP采集-ASP采集程序原理
好用的asp防SQL注入代码
asp中提取HTML中图片的SRC路径
FileSystemObject 示例代码
asp动态页面生成html页面
ASP中的常用服务器检测源码
asp无组件上传并插入到数据库里
ASP+AJAX做类似google的搜索提示
asp的RegExp对象正则表达式功能用法
ASP怎样获得代码中第一张图片地址
ASP实现多域名同一空间的处理实例
ASP无组件上载,带进度条,多文件上载
用GetString来提高ASP的速度

ASP 中的 asp 简单分页代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 143 ::
收藏到网摘: n/a

首先是recordset的创建 asp 简单分页代码
复制代码 代码如下:

<%
set rs=server.createobject("adodb.recordset")
exce="sql" 'sql 查询语句
rs.open exce,conn,1,1
%>
然后是分页属性的设置
<%
rs.PageSize=3 ‘设置页码
pagecount=rs.PageCount '获取总页码
page=int(request("page")) '接收页码
if page<=0 then page=1 '判断
if request("page")="" then page=1
rs.AbsolutePage=page '设置本页页码
%>
最后是body里的分页显示
<%
if rs.bof and rs.eof then
response.write("NULL")
else
for i=1 to rs.PageSize
response.write rs("name")
response.write("<hr>")
rs.movenext
next
end if
%>
<p>
<%if page=1 and not page=pagecount then%>
首页|前一页
<a href="log1.asp?page=<%=page+1%>">后一页</a>|
<a href="log1.asp?page=<%=pagecount%>">末页</a>
<%elseif page<>1 and not page=pagcount then%>
<a href="log1.asp?page=1">首页</a>|
<a href="log1.asp?page=<%=page-1%>">前一页</a>|
<a href="log1.asp?page=<%=page+1%>">后一页</a>|
<a href="log1.asp?page=<%=pagecount%>">末页</a>
<%elseif page=pagecount then%>
<a href="log1.asp?page=1">首页</a>|
<a href="log1.asp?page=<%=page-1%>">前一页</a>|
下一页|
末页
<%end if%>