简单分页问题!
oym 2003-11-11 08:06:30 <%
strpage=request.querystring("page")
if len(strpage)=0 then
strpage="1"
end if
dim conn
dim MM_tz_STRING
MM_tz_STRING="DBQ="+server.mappath("data.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open MM_tz_STRING
set rs=server.createobject("adodb.recordset")
rs.cursorlocation=3
sql="select * from subs"
rs.open sql,conn
if rs.eof then
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "没有记录"
response.end
end if
rs.pagesize=5
rs.absolutepage=cint(strpage)
select_count=rs.recordcount
select_pagecount=rs.pagecount
response.write "共<b>"&select_pagecount&"</b>页<b>"&select_count&"</b>条记录,本页是第<b>"&strpage&"</b>页."
if int(strpage)>1 then
response.write " <a href='subsshow.asp?page="&cstr(cint(strpage)-1)&"'>上一页</a>"
end if
if int(strpage)<select_pagecount then
response.write " <a href='subsshow.asp?page="&cstr(cint(strpage)+1)&"'>下一页</a>"
end if
response.write "<br>"
for i=1 to rs.pagesize
if rs.eof then
exit for
end if
%>
<div align="center">
<form name="form2" method="post" action="">
<p>
<input name="page" type="text" id="page" size="8">
<input type="submit" name="Submit4" value="Submit">
</p>
<p> </p>
</form>
</div></td>
</tr>
<% do while not rs.eof %>
<tr>
<td height="72"><%=rs("subs")%></td>
<td><%=rs("area")%></td>
<td><%=rs("bigarea")%></td>
<td><%=rs("subsnumber")%></td>
<td><%=rs("subsname")%></td>
</tr>
<%
rs.movenext
loop
next
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</table>
不知道哪里出错了,第一页都显示数据中所以的数据,其他的都正常,好像pagesize乱掉了