回复 2楼 cnfarer
你自己参照下面代码修改一下吧:
<%
set conn=server.createobject("adodb.connection")
conn.open("DRIVER=Driver do Microsoft Access (*.mdb);UID=admin;pwd=;dbq="&server.mappath("1.mdb"))
set rs=server.createobject("adodb.recordset")
sql="select * from student"
rs.open sql,conn,3
rs.pagesize=20
if request("page")<>"" then
epage=cint(request("page"))
if epage<1 then epage=1
if epage>rs.pagecount then epage=rs.pagecount
else
epage=1
end if
rs.absolutepage=epage
%>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#0000FF" width="80%" align="center">
<tr bgcolor="#FFFFFF" align="center">
<th><%=rs(0).name%></th><th><%=rs(1).name%></th><th><%=rs(2).name%></th>
</tr>
<%
for i=0 to rs.pagesize-1
if rs.bof or rs.eof then exit for
%>
<tr bgcolor="#FFFFFF" align="center">
<td><%=rs(0).value%></td><td><%=rs(1).value%></td><td><%=rs(2).value%></td>
</tr>
<%
rs.movenext()
next
%>
</table>
<p align="center">
<a href="">首页</a>
<a href="index.asp?page=<%=epage-1%>">前一页</a>
<a href="index.asp?page=<%=epage+1%>">后一页</a>
<a href="index.asp?page=<%=rs.pagecount%>">末页</a>
</p>
<p align="center">现在是第<%=epage%>页一共有<%=rs.pagecount%>页</p>
<%
conn.close()
%>