新闻中心

首页 > 网站知识

网站asp程序有分页的写法

<%
page=clng(request("page"))
Set rs=Server.CreateObject("ADODB.RecordSet")

sql="select * from news where a='"&a&"' order by pai desc"
rs.Open sql,conn,1,1


if rs.eof and rs.bof then
response.Write("暂时没有记录")
else
%>


<%
rs.PageSize=24
if page=0 then page=1
pages=rs.pagecount
if page > pages then page=pages
rs.AbsolutePage=page
for j=1 to rs.PageSize
%>

 

<%if rs("l3")<>"" then%>

  • " target="_blank"><%=rs("title")%>

    <%=year(rs("Infotime"))%>.<%=month(rs("Infotime"))%>.<%=day(rs("Infotime"))%>
    <%else%>
  • "><%=rs("title")%>

    <%=year(rs("Infotime"))%>.<%=month(rs("Infotime"))%>.<%=day(rs("Infotime"))%>
    <%end if%>

    <%
    rs.movenext
    if rs.eof then exit for
    next
    %>



                              <%if Page<2 then
    response.write "首页 上一页 "
    else
    response.write "首页 "
    response.write "上一页 "
    end if
    if rs.pagecount-page<1 then
    response.write "下一页 尾页"
    else
    response.write ""
    response.write "下一页
    尾页"
    end if
    response.write " 页次:"&Page&"/"&rs.pagecount&"< /strong>页 "
    response.write " 共"&rs.recordcount&"条记录 "&rs.pagesize&"条记录/页"
    response.write " 转到:"
    response.write "

    "
    %>
                           
                      

     <%
    end if
    rs.close
    set rs=nothing
    %>

  • 悦兮科技具有8年网站建设企业,专注上海手机网站建设微网站等服务,为你的企业宣传从这里开始。