您好,求助关于asp url重定向分页问题?这怎么写啊?

<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from sightn where 1=1 "&tj1&" "&tj2&" and 1=1 order by toporder,id",conn,1,1

if rs.recordcount=0 then 
else

rs.PageSize =24 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount 
page=request("page")

if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if

if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if

rs2news.AbsolutePage=Page

if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if

For i=1 To x

<% call PageControl(iCount,maxpage,page,"border=0 align=right","")
rs2news.close
set rs2news=nothing
Sub PageControl(iCount,pagecount,page,table_style,font_style)
'生成上一页下一页链接
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")

query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next

if page<=1 then 
Response.Write "<li>|<上一页</li> " 
else 
Response.Write"<li><A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">|<上一页</A></li> " 
end if

for ii=1 to pageCount
if page=ii then
Response.Write"<li class='now'>"&ii&"</a></li>"
else
Response.Write"<li><A HREF=" & action & "?" & temp & "Page=" & (ii) & ">"&ii&"</a></li>"
end if
next

if page>=pagecount then
Response.Write "<li>下页>|</li> " 
else
Response.Write "<li><A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下页>|</A></li> " 
end if
%></ul>
共计<%=iCount%>条,共<%=pageCount%>页,每页<%=iPageSize%>

守着一只汪
浏览 264回答 1
1回答

当年话下

这个是最好的ASP ACCESS的分页。set rs = conn.execute("select count(m_id) as HH_sum_vote_log from HH_say "&HS_haveid2&"")HH_sum_vote_log = rs("HH_sum_vote_log")rs.closeset rs = nothingif HH_sum_vote_log>0 thenHH_sum_page_result=Round(HH_sum_vote_log/HH_pagesize,2)HH_sum_page=cint(HH_sum_vote_log/HH_pagesize)if HH_sum_page<HH_sum_page_result thenHH_sum_page=HH_sum_page+1end ifelseHH_sum_page=1end ifif isnumeric(HH_admpg) = false thenecho ("页码有误,将为您转向第一页!")end ifif HH_admpg="" or HH_admpg<1 thenpage = 1elsepage = cint(HH_admpg)end ifif page < 1 or page > HH_sum_page thenecho ("页码有误,将为您转向第一页!")end ifHH_sumpagemax="desc"if page=HH_sum_page and page<>1 and HH_sum_page<>1 thenHH_pagesize_no=(HH_pagesize*HH_sum_page)-HH_sum_vote_logif not HH_pagesize_no=0 thenHH_pagesize=HH_pagesize-HH_pagesize_noHH_sumpagemax="asc"end ifend ifset rs=server.createobject("adodb.recordset")sql = "select * from (select top "&HH_pagesize&" * from (select top "&page*HH_pagesize&" * from HH_say "&HS_haveid&" order by Val([m_id]) "&HH_sumpagemax&") order by Val([m_id])) order by Val([m_id]) desc"rs.open sql,conn,1,1if rs.eof thenecho ("<script language='javascript'>alert('本项目没有访客留言,请返回!');window.history.go(-1);</script>")rs.closeset rs=nothingexit subend ifdo while not rs.eofrs.movenextloop<div id="H_page">第<%=page%>/<%=HH_sum_page%>页 共<%=HH_sum_vote_log%>条记录<%if page=1 then%>首页<%else%><a href="?class=<%=HH_admclass%><%=HH_idshow%>&pg=1" id="lianjie" class="zw">首页</a><%end ifif page<>1 then%><a href="?class=<%=HH_admclass%><%=HH_idshow%>&pg=<%=page-1%>" id="lianjie" class="zw">上一页</a>..<%else%>上一页<%end ifpg_px_top=page-5pg_px_botton=page+5for i=pg_px_top to pg_px_bottonif i<1 or i>HH_sum_page thenelseif i=page thenresponse.write ielse%><a href="?class=<%=HH_admclass%><%=HH_idshow%>&pg=<%=i%>"><%=i%></a><% end ifend ifnextif page<>HH_sum_page then%>..<a href="?class=<%=HH_admclass%><%=HH_idshow%>&pg=<%=page+1%>" id="lianjie" class="zw">下一页</a><%else%>下一页<%end ifif page<>HH_sum_page then%><a href="?class=<%=HH_admclass%><%=HH_idshow%>&pg=<%=HH_sum_page%>" id="lianjie" class="zw">尾页</a><%else%>尾页<%end ifecho ("</div>")rs.closeset rs=nothing%>目前最好的ASP ACCESS分页法,无偿奉献
打开App,查看更多内容
随时随地看视频慕课网APP