你的位置:| 首页网站建设一个完整的asp+access的分页实例→文章正文  
文章导航


一个完整的asp+access的分页实例源码


<%id=Trim(Request.QueryString("id"))
bid=Trim(Request.QueryString("bid"))%>
<!--#include file="conn.asp"-->
<%set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from "&bid&" order by id desc"
rs.open sql,conn,1,3

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=left((bid),4)%>届<%=right((bid),1)%>班管理中心!</title>
</head>

<body>

<table width="900" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#99ccff">
<tr>
<td align="center"><%=left((bid),4)%>届<%=right((bid),1)%>班学员列表</td>
</tr>
</table>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#BFDFFF">
<tr>
<td align="center">&nbsp;</td>
</tr>
</table>
<table width="900" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#E6FAFF" bordercolordark="#FFFFFF" bgcolor="#E6FAFF">
<tr>
<td>姓名</td>
<td>性别</td>
<td>身份证号码</td>
<td>地址</td>
<td>电话</td>
<td>电邮</td>
<td>QQ</td>
<td>手机</td>
</tr>
<%
rs.pagesize=20
allpage=cint(rs.RecordCount/rs.pagesize)
rpage=Request.QueryString("rpage")
if rpage="" then rpage=1
rs.absolutepage=rpage
for i= 1 to rs.pagesize
if rs.eof then
exit for
end if
%>
<tr>
<td><%=rs("uname")%></td>
<td><%=rs("xingbie")%></td>
<td><%=rs("senfen")%></td>
<td><%=rs("dizhi")%></td>
<td><%=rs("tel")%></td>
<td><%=rs("email")%></td>
<td><%=rs("qq")%></td>
<td><%=rs("tel2")%></td>
</tr>
<%
rs.movenext
next%>
</table>

<table width="900" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#E6FAFF" bordercolordark="#FFFFFF" bgcolor="#E6FAFF">
<tr bgcolor="#62DFFF">
<td align="center" bgcolor="#C8F4FF">
<%Response.Write("共有"&Trim(rs.RecordCount)&"条学员记录")%>
<%if rpage=1 then%>
首页
<%else%>
<a href="hy_list.asp?bid=<%=bid%>&pid=1">首页</a>
<%end if%>
<%if rpage=1 then%>
上一页
<%else%>
<a href="hy_list.asp?bid=<%=bid%>&pid=<%=Request("pid")%>&rpage=<%=rpage-1%>">上一页</a>
<%end if%>
<%if rs.pagecount<rpage+1 then%>
下一页
<%else%>
<a href="hy_list.asp?bid=<%=bid%>&pid=<%=Request("pid")%>&rpage=<%=rpage+1%>">下一页</a>
<%end if%>
<%if rs.pagecount<rpage+1 then%>
尾页
<%else%>
<a href="hy_list.asp?bid=<%=bid%>&pid=<%=Request("pid")%>&rpage=<%=rs.pagecount%>">尾页</a>
<%end if%>
<%Response.Write "当前第"&rpage&"页 共"&Trim(allpage)&"页" %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
</tr>
</table>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#99ccff">
<tr>
<td align="center">&nbsp;</td>
</tr>
</table>
<table width="900" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#E6FAFF" bordercolordark="#FFFFFF" bgcolor="#E6FAFF">
<form name=ck method=post action="<%=Request.ServerVariables("Script_Name")%>">
<tr bgcolor="#62DFFF">
<td align="center" bgcolor="#C8F4FF"><a href="hy_list.asp?bid=<%=bid%>&rpage=1">首页</a>
<%if rpage>1 then%>
<a href="hy_list.asp?bid=<%=bid%>&rpage=<%=rpage-1%>">上页</a>
<%else%>
上页
<%end if%>
<%for i=1 to allpage%>
<%if rpage+1>=int(rpage/rs.PageSize)*rs.PageSize then%>
<a href="hy_list.asp?bid=<%=bid%>&rpage=<%=int(rpage/rs.PageSize)*rs.PageSize+i%>">[<%=int(rpage/rs.PageSize)*rs.PageSize+i%>]</a>
<%end if%>
<%next%>
<%if rpage+1<rs.PageCount+1 then%>
<a href="hy_list.asp?bid=<%=bid%>&rpage=<%=rpage+1%>">下页</a>
<%else%>
下页
<%end if%>
<a href="hy_list.asp?bid=<%=bid%>&rpage=<%=rs.PageCount%>">尾页</a> </td>
</tr>
</form>
</table>
<% rs.close %>
</body>
</html>

上一篇 ASP数据库分页代码实例 上一页 1 2 3 4 5 下一页
 
公司简介 在线客服 客服中心 意见反馈 相关法律 隐私条款 广告服务 友情链接
Q链:515347638  电子邮箱:hanen@126.com 粤ICP备05086553