<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>学生信息表</title> </head> <body> <% dim conn,dbpath set conn=server.createobject("adodb.connection") dbpath=server.mappath("student.mdb") conn.open "provider=microsoft.jet.oledb.4.0;data source="&dbpath set rs=server.createobject("adodb.recordset") sqlstr="select * from stud_info order by stud_id" rs.open sqlstr,conn,1,1 response.write "本表格共有"&rs.recordcount&"条记录:<br>" if rs.recordcount>0 then %> <table width=760 border=1 cellpadding=3 cellspacing=0 bgcolor=#EFEFEF> <tr bgcolor=#CEDBFF> <td width=60>学号</td><td width=70>姓名</td><td width=50 align=center>性别</td><td width=100>出生日期</td> <td width=160>地址</td><td width=120>电话</td><td width=50>邮编</td><td width=80 align=right>所在系号</td> <td width=70 align=right>奖学金</td></tr> <% rs.pagesize=4 page=cint(request.form("page")) if page="" then page=1 if page<1 then page=1 if page>=rs.pagecount then page=rs.pagecount rs.absolutepage=page for i=1 to rs.pagesize %> <tr><td><%=rs("stud_id")%></td><td><%=rs("name")%></td><td align=center><%=rs("gender")%></td> <td><%=rs("birthday")%></td><td><%=rs("address")%></td><td><%=rs("telcode")%></td> <td><%=rs("zipcode")%></td><td align=right><%=rs("deptcode")%></td><td align=right><%=rs("salary")%></td> </tr> <% rs.movenext if rs.eof then exit for next end if %> </table> <table width=760 border=1 cellpadding=3 cellspacing=0 bgcolor=#EFEFEF> <tr> <td width=760 align=right> <a href="sb1.asp"?page=1>首页</a> <a href="sb1.asp"?page="&(page-1)&">上页</a> <a href="sb1.asp"?page="&(page+1)&">下页 </a><a href="sb1.asp"?page="&rs.pagecount&">未页</a> </td> </tr> </table> <%
rs.close set rs=nothing conn.close set conn=nothing %> </body> </html> 不知道错在什么地方了!测试时总是显示在第一页,第二页第三页翻不下去! 在IE发地址栏中输入http://localhost/sb1.asp?page=2也无法翻页 小妹新手,请大家帮忙!
[此贴子已经被作者于2004-06-23 20:43:19编辑过]