分页代码不分页
以下代码可显示分页码,有上一页、下一页提示和链接。但修改“rs.pagesize=10”此数实际上不能改页码数,还是显示超过10行以上的内容。实际上没有分页。请高手指教!谢谢
Question.rar
(9.73 KB)
<!--#include file="conn2.asp"-->
<link href=font.css rel=stylesheet>
<div align="center">
<%
set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews"
rs.open sql,cn,1,1
s=rs.recordcount
rs.close
set rs=nothing
set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews where up1=1"
rs.open sql,cn,1,1
s=rs.recordcount
rs.close
set rs=nothing
set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews where up2=1"
rs.open sql,cn,1,1
s1=rs.recordcount
rs.close
set rs=nothing
set rs=server.CreateObject("adodb.recordset")
sql="select id from scunews where up3=1"
rs.open sql,cn,1,1
s2=rs.recordcount
rs.close
set rs=nothing
%>
<div align="center"><center>
<table border="1" borderColor="#000000" cellPadding="0"
style="border-collapse: collapse; border-bottom: medium none" width="100%" cellspacing="1">
<tr>
<td width="6%" align="center"><b><font color="#FF0000"><%=s%></font></b><font color="#800000">次</font></td>
<td width="6%" align="center"><font color="#FF0000"><b><%=s1%></font></b><font color="#800000">次</font></td>
<td width="6%" align="center"><font color="#FF0000"><b><%=s2%></font></b><font color="#800000">次</font></td>
</tr>
</table>
<hr size="1px" color="#218FF3">
<%
dim page
page=Clng(request("page"))
rs.pagesize=10'此值设置十行一页但修改此数实际上不能改页码数,请高手指教!谢谢
if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
rs.Absolutepage=page
%>
<div align="center"><center>
<table border="1" borderColor="#000000" cellPadding="0"
style="border-collapse: collapse; border-bottom: medium none" width="100%" cellspacing="1">
<%
for i=1 to rs.pagesize
%>
<%
set rs=cn.execute("select * from scunews")
do while not rs.eof
%>
<tr align="center">
<td width="6%" align="center"><div id="div1">
<%if rs("up1")=0 then%>
<a href="?act=up1&id=<%=rs("id")%>">已签到</a>
<%else%>
<a href="?key=up1&id=<%=rs("id")%>"><font color="#FF0000">未签到</font></a>
<%end if%>
</div></td>
<td width="6%" align="center"><%if rs("up2")=0 then%>
<a href="?act=up2&id=<%=rs("id")%>">已签到</a>
<%else%>
<a href="?key=up2&id=<%=rs("id")%>"><font color="#FF0000">未签到</font></a>
<%end if%></td>
<td width="6%" align="center"><div id="div">
<%if rs("up3")=0 then%>
<a href="?act=up3&id=<%=rs("id")%>">已签到</a>
<%else%>
<a href="?key=up3&id=<%=rs("id")%>"><font color="#FF0000">未签到</font></a>
<%end if%>
</div></td>
</tr>
<%
rs.movenext
loop
conn.close
%>
</table>
</div>
<%
id=request("id")
if request("act")<>"" then
set rs=cn.execute("update scunews set "&request("act")&"=1 where id="&id&"")
conn.close
response.Redirect("2index.asp")
end if
if request("key")<>"" then
set rs=cn.execute("update scunews set "&request("key")&"=0 where id="&id&"")
conn.close
response.Redirect("2index.asp")
end if
%>
<%
rs.movenext
if rs.eof then exit for
next
%>
<%
if page<>1 then
response.write "<a href=2index.asp?page=1>首页</a> "
response.write "<a href=2index.asp?page="&(page-1)&">上一页</a> "
end if
if page<>rs.pagecount then
response.write "<a href=2index.asp?page="&(page+1)&">下一页</a> "
response.write "<a href=2index.asp?page="&rs.pagecount&">尾页</a> "
end if
%>
</div>
[ 本帖最后由 a190066 于 2010-7-13 02:39 编辑 ]