+ -
当前位置:首页 → 问答吧 → 求高手解释!!ASP翻页功能

求高手解释!!ASP翻页功能

时间:2011-12-09

来源:互联网

<%
dim strFileName
const MaxPerPage=2
dim totalPut,CurrentPage,TotalPages
if request("page")<>"" then
  currentPage=cint(request("page"))
else
currentPage=1
end if
strFileName="show.asp?B.Username="&B.Username&"&"&"A.Content="&A.Content&"&"&"A.Scoring="&A.Scoring&"&"&"A.Date="&A.Date&""'页面的设置!-提示
%>
<%
the_class=1 '开通
'查询语句开始
sql="SELECT B.Username, A.Scoring, A.Content, A.Date FROM [Comments] AS A, [User] AS B WHERE A.UserID = B.UserID AND A.Checked = 1"
if B.Username<>"" then
sql=sql&" and name like'%"&B.Username&"%'"
end if
if A.Scoring <> "" then
sql=sql&" and star = " & A.Scoring & ""
end if
if A.Content<>"" then
sql=sql&" and city="&A.Content&""
end if
if A.Date<>"" then
sql=sql&" and info like'%"&A.Date&"%'"
end if
'价格区域


sql=sql
set rs=server.CreateObject("ADODB.recordset")
rs.open sql,conn,1,1
totalPut=rs.recordcount
if rs.eof and rs.bof then
response.write "<div align=center><p><font color=red><--暂无任何信息--></font></p></div>"
else
%>
<%
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 strFileName,totalput,MaxPerPage,true,true,"条信息"
  else
  if (currentPage-1)*MaxPerPage<totalPut then
  rs.move (currentPage-1)*MaxPerPage
  dim bookmark
  bookmark=rs.bookmark
  showContent
  showpage strFileName,totalput,MaxPerPage,true,true,"条信息"
  else
currentPage=1
  showContent
  showpage strFileName,totalput,MaxPerPage,true,true,"条信息"
end if
end if
rs.close
set rs=nothing %>
  <%sub showContent
  dim page_Num
  page_Num=0%>
<%
do while not rs.eof



我这个页面的设置,路径要怎么写?

作者: boyuan168   发布时间: 2011-12-09

你就正常写你的链接 只不过在本页分页的时候下一页和上一页的时候你要传递参数

分页代码:http://www.cnblogs.com/ShineTan/archive/2006/02/24/336867.html

作者: hefeng_aspnet   发布时间: 2011-12-09