展开全部
首先是recordset的创建
<%
set rs=server.createobject("adodb.recordset")
exce="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%>
<%
set rs=server.createobject("adodb.recordset")
exce="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%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询