asp分页显示问题!请帮忙下,谢谢!

来源:百度知道 编辑:UC知道 时间:2024/05/17 23:32:27
分不是太多!希望大家帮下忙,谢谢!
如何在下面这段代码添加分页显示?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="gb2312">
<head>
<title>数据查询页</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="gb2312" />
</head>
<body bgcolor="#000000">
<p align="center"><font color="red"><b><span lang="zh-cn">
<font size="6" face="华文隶书">数据记录系统</font></span

若数据库查询页为search.asp
<!--#include file="conn.asp"-->
<% Set rs = server.CreateObject("ADODB.Recordset")
sql="select * from add_T order by id desc"
rs.Open sql,conn,1,1
if request("page")="" then
page=1
else
page=cint(request("page"))
end if
rs.pagesize=9
if page=0 then page=1
if page>rs.pagecount then page=rs.pagecount
rs.absolutepage=page if not rs.eof then
do while not rs.eof
%>
'在需要显示分页的地方,载入如下内容
<%
if page=1 then
response.write"[首页]"
end if
if page<>1 then
response.write"<a href=search.asp?page=1>[首页]</a>"
response.write"<a href=search.asp?page="&(page-1)&">[上一页]</a>"
end if
if page<>rs.pagecount then
response.write"<a href=search.asp?page="&(page+1)&">[下一页]</a>