1 回答
TA贡献1890条经验 获得超9个赞
这个是最好的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.close
set rs = nothing
if HH_sum_vote_log>0 then
HH_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 then
HH_sum_page=HH_sum_page+1
end if
else
HH_sum_page=1
end if
if isnumeric(HH_admpg) = false then
echo ("页码有误,将为您转向第一页!")
end if
if HH_admpg="" or HH_admpg<1 then
page = 1
else
page = cint(HH_admpg)
end if
if page < 1 or page > HH_sum_page then
echo ("页码有误,将为您转向第一页!")
end if
HH_sumpagemax="desc"
if page=HH_sum_page and page<>1 and HH_sum_page<>1 then
HH_pagesize_no=(HH_pagesize*HH_sum_page)-HH_sum_vote_log
if not HH_pagesize_no=0 then
HH_pagesize=HH_pagesize-HH_pagesize_no
HH_sumpagemax="asc"
end if
end if
set 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,1
if rs.eof then
echo ("<script language='javascript'>alert('本项目没有访客留言,请返回!');window.history.go(-1);</script>")
rs.close
set rs=nothing
exit sub
end if
do while not rs.eof
rs.movenext
loop
<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 if
if page<>1 then
%>
<a href="?class=<%=HH_admclass%><%=HH_idshow%>&pg=<%=page-1%>" id="lianjie" class="zw">上一页</a>..
<%else%>
上一页
<%end if
pg_px_top=page-5
pg_px_botton=page+5
for i=pg_px_top to pg_px_botton
if i<1 or i>HH_sum_page then
else
if i=page then
response.write i
else%>
<a href="?class=<%=HH_admclass%><%=HH_idshow%>&pg=<%=i%>"><%=i%></a>
<% end if
end if
next
if page<>HH_sum_page then
%>
..<a href="?class=<%=HH_admclass%><%=HH_idshow%>&pg=<%=page+1%>" id="lianjie" class="zw">下一页</a>
<%else%>
下一页
<%end if
if page<>HH_sum_page then%>
<a href="?class=<%=HH_admclass%><%=HH_idshow%>&pg=<%=HH_sum_page%>" id="lianjie" class="zw">尾页</a>
<%else%>
尾页
<%end if
echo ("</div>")
rs.close
set rs=nothing
%>
目前最好的ASP ACCESS分页法,无偿奉献
添加回答
举报