最简单的ASP分页代码
<%
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from news order by id desc"
rs.open sql,conn,3,1
rs.pagesize=10
if request("page")<>"" then
epage=cint(request("page"))
if epage<1 then epage=1
if epage>rs.pagecount then epage=rs.pagecount
else
epage=1
end if
rs.absolutepage=epage
if not rs.eof then
for i=0 to rs.pagesize-1
if rs.bof or rs.eof then exit for
response.write("循环输出新闻.")
rs.movenext()
next %>
<%if epage<>1 then%>
<a href="?page=0">首页</a>
<%else%>
首页
<%end if%>
<%if epage>1 then%>
<a href="?page=<%=epage-1%>">前一页</a>
<%else%>
前一页
<%end if%>
<%if epage<rs.pagecount then%>
<a href="?page=<%=epage+1%>">后一页</a>
<%else%>
后一页
<%end if%>
<%if epage<rs.pagecount then%>
<a href="?page=<%=rs.pagecount%>">末页</a>
<%else%>
末页
<%end if%>
<%else%>
目前还没有新闻
<%end if%>