注册 登录
编程论坛 ASP技术论坛

网页显示问题

青年求知 发布于 2008-11-02 14:37, 707 次点击
我设置了一页只显示五条纪录,可我想点"下一页"时,把余下的纪录也显示出来,该怎么做呢?

知道的麻烦请教我下,谢谢了.
4 回复
#2
yms1232008-11-02 14:45
#3
shcms2008-11-03 14:09
<%
const MaxPerPage=14 '每页显示多少条记录
dim sql
dim rs
dim totalPut   
dim CurrentPage
dim TotalPages
sql = "SELECT * FROM News order by id asc"    'SQL查询不用说了吧
set rs=server.createobject("adodb.recordset")
rs.open SQL,conn,1,1
rs.MoveFirst
rs.pagesize=MaxPerPage
howmanyfields=rs.Fields.Count-1
If trim(Request("Page"))<>"" then
CurrentPage= CLng(request("Page"))
If CurrentPage> rs.PageCount then
CurrentPage = rs.PageCount
End If
Else
CurrentPage= 1
End If
if rs.eof then
response.write "<p align='center'> ERROR!</p>"
else
totalPut=rs.recordcount
if CurrentPage<>1 then
if (currentPage-1)*MaxPerPage<totalPut then
rs.move(currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
end if
end if
dim n,k
if (totalPut mod MaxPerPage)=0 then  
n= totalPut \ MaxPerPage
else  
n= totalPut \ MaxPerPage + 1  
end if
for i= 0 to howmanyfields
next    
i=0
do while not rs.eof and i<maxperpage%>

<%=rs("title")%>   '里边写你要循环的内容

<%
i=i+1
rs.movenext
loop
%>

&nbsp;&nbsp;&nbsp;当前第&nbsp;&nbsp;<%=currentpage%>页&nbsp;&nbsp;共&nbsp;&nbsp;<%=n%>页&nbsp;&nbsp;<%=rs.recordcount%>&nbsp;

纪录
<%k=currentPage
if k<>1 then
response.write "&nbsp;[<b>"+"<a href='?page=1'>首页</a></b>]&nbsp;"
response.write "&nbsp;[<b>"+"<a href='?page="+cstr(k-1)+"'>上一页</a></b>]&nbsp;"
else
Response.Write "&nbsp;[首页]&nbsp;[上一页]&nbsp;"
end if
if k<>n then
response.write "&nbsp;[<b>"+"<a href='?page="+cstr(k+1)+"'>下一页</a></b>]&nbsp;"
response.write "&nbsp;[<b>"+"<a href='?page="+cstr(n)+"'>尾页</a></b>]&nbsp;"
else
Response.Write "&nbsp;[下一页]&nbsp;[尾页]&nbsp;"
end if
end if
rs.close
set rs=nothing
%>
欢迎你到我的博客一起讨论   www.
#4
青年求知2008-11-03 19:33
回复 2# 的帖子
谢谢
#5
青年求知2008-11-03 19:34
回复 3# 的帖子
谢谢
1