日期:2014-05-17 浏览次数:21140 次
<% dim cnstr,epage,i,count,a a=request.QueryString("id") cnstr = "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.MapPath("./sb.mdb") dim rs set cn = server.CreateObject("adodb.connection") cn.Open cnstr sql = "select * from user,rz where user.U_ID=rz.U_ID and U_ID="&a&" order by R_Time desc" set rs = server.createobject("adodb.recordset") rs.open sql,cn,3 If (rs.bof And rs.EOF) Then else rs.pagesize=20 '设置每页记录数 if request("page")<>"" then epage=cint(request("page")) '取当前的页数 if epage<1 then epage=1 '若当前页数小于1则置为1 if epage>rs.pagecount then epage=rs.pagecount '若当前页数大于最大页数值则置为最大页数 else epage=1 '否则页数为默认值1 end if rs.absolutepage=epage '记录定位到当前页 for i=0 to rs.pagesize-1 '循环显示本页记录 if rs.bof or rs.eof then exit for '若已经到记录末尾或没有数据则退出循环 count = count+1 response.Write "<tr>" response.write "<td align='left' width='40%' > "&rs("U_Xm")&"</td>" response.Write "<td align='center' width='40%'>"&rs("R_Time")&"</td>" response.write "<td align='center' width='20%'>"&rs("R_Cz")&"</td>" response.Write "</tr>" rs.movenext next end if %> <tr> <td valign="bottom" colspan="3"> <p align="center"> <br /> <br /> <br /> <a href="grrz.asp?id=<%=id%>&page=1" target="_self">首页</a> <%if epage > 1 then%> <a href="grrz.asp?id=<%=id%>&page=<%=epage-1%>" target="_self">前一页</a> <% end if if epage < rs.pagecount then %> <a href="grrz.asp?id=<%=id%>&page=<%=epage+1%>" target="_self">后一页</a> <%end if%> <a href="grrz.asp?id=<%=id%>&page=<%=rs.pagecount%>" target="_self">末页</a></p> <p align="center" style="vertical-align:bottom">现在是第<%=epage%>页 一共有<%=rs.pagecount%>页 每页20条记录 总共有<% =rs.RecordCount %>条记录</p> <% cn.Close set cn = nothing %>