<% usrsql="SELECT * from [news_page] order by news_time desc" Set usrrs = Server.CreateObject("ADODB.Recordset") usrrs.OPEN usrsql, Conn,3,1 '设置每页的大小 PageSize =100 usrrs.PageSize = PageSize ' 得到总的页数 TotalPages = usrrs.PageCount ' 得到总记录数 TotalRecords = usrrs.RecordCount '检查记录集是否为空 If TotalRecords<1 Then Response.Write "今天没有新留言!" else ' 得到用户选择的动作 PageAction = Request.Form("PageAction") ' 根据动作重设页码 Select Case PageAction Case "首页" Session("Page")=1 Case "上页" Session("Page")=Session("Page")-1 Case "下页" Session("Page")=Session("Page")+1 Case "尾页" Session("Page")=TotalPages Case Else Session("Page")=1 End Select ' 检查页码是否越界:1<= Page <=TotalPages If CInt(Session("Page"))<1 Then Session("Page")=1 End If If CInt(Session("Page"))>TotalPages Then Session("Page")=TotalPages End If ' 跳转到指定页 usrrs.AbsolutePage = Session("Page") %> <% i=0 j=0 Do While Not usrrs.Eof And ii = i + 1