<%
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%>