2栏分页显示(附显示的形式前页,后页)


所属类别:Asp

文章作者:佚名

特别推荐:免费发布信息 承包关键词~~抢爆了!HOT!


显示形式:ID1NAME ID2NAME1JULIET 2PALYBOY3BABY4TOM5LENA6JERY>>首页 前页 后页 尾页页数:1/46条/页总记录数:25条代码:<!--page1.asp--><!--#include file="conn.asp"--><%dim rsdim sqlmsg_per_page=4'定义每页显示记录条数set rs=server.createobject("adodb.recordset")sql = "select * from page order by id"'改成你自己的SQL语句rs.cursorlocation=3'使用客户端游标,可以使效率提高rs.pagesize=msg_per_page'定义分页记录集每页显示记录数rs.open sql,conn,0,1if err.number<>0 then'错误处理response.write "数据库操作失败:" & err.descriptionerr.clearelseif not (rs.eof and rs.bof) then'检测记录集是否为空totalrec=RS.RecordCount'totalrec:总记录条数if rs.recordcount mod msg_per_page=0 then'计算总页数,recordcount:数据的总记录数n=rs.recordcount\msg_per_page'n:总页数elsen=rs.recordcount\msg_per_page+1end ifcurrentpage=request("page")'currentpage:当前页If currentpage <> "" thencurrentpage =cint(currentpage)if currentpage < 1 thencurrentpage = 1end ifif err.number <> 0 thenerr.clearcurrentpage=1end ifelsecurrentpage = 1End ifif currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)thencurrentPage=1end ifrs.absolutepage=currentpage'absolutepage:设置指针指向某页开头rowcount=rs.pagesize'pagesize:设置每一页的数据记录数dim idim k%>ID1name1ID2name2<%do while not rs.eof and rowcount > 0%><%=rs("id")%><%=rs("testname")%><%rowcount=rowcount-1rs.MoveNextif not rs.EOF then%><%=rs("id")%><%=rs("testname")%><%rowcount=rowcount-1rs.MoveNextelseResponse.Write "  "end ifloopend ifend ifrs.closeset rs=nothing%><%call listPages()%><%sub listPages()if n <= 1 then exit sub%>>><%if currentpage=1 then%>Top Previous<%else%>?page=1">Top ?page=<%=currentpage-1%>">Previous<%end if%><%if currentpage=n then%>Next Bottom<%else%>?page=<%=currentpage+1%>">Next ?page=<%=n%>">Bottom<%end if%>  Page:<%=currentpage%>/<%=n%>pages  <%=msg_per_page%>notes/page   Total:<%=totalrec%>notes<%end sub%> 关闭本页

相关信息

· .net精华:C

· 分手吧!亲爱的!

· 项目人生,成长与感悟(1)——关键成功要素

· 教你在asp.net中动态变更CSS








....

38502 46434