ASP 分页显示代码

来源:百度文库 编辑:神马文学网 时间:2024/04/30 00:36:40
<%
'连接数据库

'执行sql 改你要的sql
set rs=server.CreateObject("adodb.recordset")%>
rs.open "select * from news order by id desc ",conn,1,3

下面的代码就复制用可以了

'分页
i=50
rs.pagesize=i
pu=request("pu")
if pu="" then pu=1
if cint(pu)<="0" then pu=1
if cint(pu)>rs.pagecount then pu=rs.pagecount
if not rs.eof then rs.absolutepage=cint(pu)
'显示记录
if not rs.eof then
do while not rs.eof and i=>1
response.write rs("字段")'显示字段
'就这里改你要的,其它复制用就可以
rs.movenext
i=i-1
loop
end if
%>

当前第 <%=pu%> 页;分
<%=rs.pagecount%> 页;
共 <%=rs.recordcount%> 条记录;
每页<%=i%>条记录
首 页
上一页
下一页
末 页