asp分页显示问题---在线等
给出分页显示的思路就可以 如果能详细些或付部分主要代码更好 先多谢各位大侠了
------解决方案-------------------- <%
Const MaxPerPage=20
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if request( "page ") <> " " then
currentPage=Cint(request( "page "))
else
currentPage=1
end if
set rs=server.CreateObject( "adodb.recordset ")
if request( "keyword ")= " " then
sql= "select * from Adcraft order by id desc "
else
sql= "select * from Adcraft where "&request( "search ")& " like '% "&request( "keyword ")& "% ' order by id desc "
end if
rs.open sql,conn,3,3
if err.number <> 0 then
response.write "数据库中暂时无数据 "
end if
if rs.eof And rs.bof then
Response.Write " <p align= 'center ' class= 'contents '> 数据库中暂时无数据! </p> "
else
totalPut=rs.recordcount
if currentpage <1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage> totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage totalput,MaxPerPage, "Manage.asp "
else
if (currentPage-1)*MaxPerPage <totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage, "Manage.asp "
else
currentPage=1
showContent
showpage totalput,MaxPerPage, "Manage.asp "
end if
end if
end if
sub showContent
dim i
i=0%>
<%
mj=0
do while not rs.eof
mj=mj+1
%>
在里放上循环体~~~~~~~~~~~~~~~~~
<%i=i+1
if i> =MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing%>
<% End Sub
Function showpage(totalnumber,maxperpage,filename)
Dim n
If totalnumber Mod maxperpage=0 Then
n= totalnumber \ maxperpage
Else
n= totalnumber \ maxperpage+1
End If
Response.Write " <form method=Post action= "&filename& "?star= "&request( "star ")& "> "
Response.Write " <p align= 'center ' class= 'contents '> "
If CurrentPage <2 Then
Response.Write " <font class= 'contents '> 首 页 上一页 </font> "
Else
Response.Write " <a href= "&filename& "?star= "&request( "star ")& "&type= "&request( "type ")& "&page=1 class= 'contents '> 首 页 </a> "
Response.Write " <a hre