简洁asp翻页代码

2025-01-07 09:36:20
推荐回答(1个)
回答1:

<%
exec="select * from 表"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
rs.PageSize =20
If page1 < 1 Then page1 = 1
If page1 > rs.PageCount Then page1 = rs.PageCount
if not rs.eof then rs.AbsolutePage =page1
For i = 1 To rs.PageSize
If rs.EOF Then Exit For
%>
输出内容
<%
rs.movenext
next
ts=rs.recordcount
if ts="" then ts=0 %>
<%=ts%>
第<%for i=1 to rs.PageCount%>

<%
if i=page1 then
response.write i
else
response.write "["+cstr(i)+"]"
end if
%>

<%next
if rs.pagecount=0 then response.write "1"%>页