关于分页,急!(在线等待)
<!--#include file="adovbs.inc"-->
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DBQ="& Server.MapPath("student.mdb") &";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;"
%>
<html>
<head>
<title>result</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<%Set Rs = Server.CreateObject("ADODB.Recordset")
name=request("name")
area=Request("area")
sql="select * from tbl_stu where (" '查询
if name<>"" then
sql=sql&"stu_name like"&"'%"&name&"%'"
flag=1 '判断是否选中查询条件flag=1选中flag=0没选中
end if
if area<>"1" and flag=1 then
sql=sql&" and area="&"'"&area&"'"
flag=1
elseif area<>"1" then
sql=sql&" area="&"'"&area&"'"
flag=1
end if
sql=sql&")"
if name="" and area="1" then
sql="select * from tbl_stu" '什么都没选的话输出所有资料
end if
mypage=Request.QueryString("whichpage") 'whichpage是表示当前表示的是第几页
if mypage="" then
mypage=1
end if
mypagesize=Request.QueryString("pagesize") 'mypagesize表示一页中应该包含的记录数
if mypagesize="" then
mypagesize=10
end if
rs.CursorLocation=aduseclient
rs.CacheSize=5
rs.Open sql,conn
rs.pagesize=mypagesize
maxcount=cint(rs.PageCount) 'maxcount表示一共含有多少页
rs.AbsolutePage=mypage
howmanyrecs=0 'howmanyresc表示当前表示的是第几条记录
howmanyfields=rs.recordcount-1 'howmanyfields表示一共含有多少记录
Response.Write"page"&mypage&"of"&maxcount&"<br>"
%>
</html>
<body bgcolor="#FFFFFF" text="#000000">
<p> </p>
<p align="center"><font color="#000000" size="6">学生信息搜索结果 </font></p>
<table width="104%" border="1" bordercolor="#000000" align="center" cellpadding="0" cellspacing="0" height="31">
<tr bordercolor="#000000">
<td width="5%"> <div align="center">ID</div></td>
<td width="11%"> <div align="center">姓名</div></td>
<td width="26%"> <div align="center">地址</div></td>
<td width="17%"> <div align="center">邮政编码</div></td>
<td width="13%"> <div align="center">电话</div></td>
<td width="14%"> <div align="center">email</div></td>
<td width="14%"> <div align="center">地区</div></td>
</tr>
<p align="center"> </p>
<%for i=0 to howmanyfields%>
<%do while not rs.EOF and howmanyrecs<rs.pagesize%>
<tr bordercolor="#000000">
<td valign="center" align="lift" width="5%"><%=rs("stu_ID")%> </td>
<td valign="center" align="lift" width="11%"><%=rs("stu_name")%> </td>
<td valign="center" align="lift" width="26%"><%=rs("stu_address")%> </td>
<td valign="center" align="lift" width="17%"><%=rs("zip_code")%> </td>
<td valign="center" align="lift" width="13%"><%=rs("stu_tel")%> </td>
<td valign="center" align="lift" width="14%"><%=rs("email")%> </td>
<td valign="center" align="lift" width="20%"><%=rs("area")%> </td>
</tr>
<%
rs.MoveNext
howmanyrecs=howmanyrecs+1
loop
%>
<%next%>
</table>
<%
pad="0"
scriptname=Request.ServerVariables("script_name")
for counter=1 to maxcount 'counter是表示第几页
if counter>=10 then
pad=""
end if
ref="<a href="&scriptname&"?whichpage="&counter&"&pagesize="&mypagesize&">"&pad&counter&"</a>"
Response.Write ref &" "
if counter mod 10 then
Response.Write"<br>"
end if
next
%>
</body>
</html>
不好意思,我已经看过以前的贴子了还是不知道怎么解决,请多多指教,十分感谢!
请帮我看看为什么不能正确显示下一页?