ASP分页出错

来源:百度知道 编辑:UC知道 时间:2024/06/24 15:43:14
下面是代码:

<!--#include file="conn.asp"-->

<%
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
%>
<%if rs.eof and rs.eof then
response.write("还米有文章")
else%>
<%for i=1 to rs.pagesize%>
<head>
<title></title>
<title></title>
</head>
<body bgcolor="#E0FCFE">
<table border="0" width="100%">
<tr>
<td width="25%"></td>
<td width="50%" colspan="2"></td>
<td width="25%"></td>
</tr>
<tr>
<td width="25%"></td>
<td width="25%"></td>
<td w

多加几个判断

page=int(request("page"))
if IsNumeric(page)=false then page=1 '如果页码不是数字,将当前页赋值为1
if page<=0 then page=1
if request("page")="" then page=1
if page>pagecount then page=pagecount '判断当前页是否大于总页数,如果大于,将当前页赋值pagecount(总页数)
rs.AbsolutePage=page

.........
<%for i=1 to rs.pagesize
if rs.Eof then Exit for '如果数据指针到最后,退出循环
%>
...........


<%if rs.eof and rs.eof then
response.write("还米有文章")

放到Rs.Open Sql,Conn,1,1
下面