我也不知道我分页哪里有错,我想要它每页显示20,它就是显示大于20条记录,代码如下:
<!--#Include file="linkdata.asp"-->
<div align="center">
<table border="0" width="163" cellpadding="0" style="border-collapse: collapse">
<tr>
<%
Set rs=Server.Createobject("ADODB.Recordset")
picsql="Select * from pic Order By id Desc"
rs.open picsql,conn,1,1
'if not(rs.bof and rs.eof) then
if rs.recordcount>=1 then
if request.querystring("pic_page")="" then
pic_page=1
else
pic_page=cint(request.querystring("pic_page"))
end if
else
response.write "对不起.暂时还没相片,请等待上传……"
end if
for b=1 to rs.recordcount
if rs.eof or rs.bof then exit for
%>
<td>
<table border="0" width="88%" cellpadding="0" style="border-collapse: collapse" id="table1">
<tr>
<td>
<p align="center"><%=rs("pic_name")%>
</td>
</tr>
<tr>
<td>
<table border="0" width="86%" cellpadding="0" style="border-collapse: collapse" id="table2">
<tr>
<td>
<a href="show_pic2.asp?picbig=<%=rs("id")%>" target="_blank">
<img border="0" src="up/uppic/<%=rs("pic_address")%>" width="160" height="147"></a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="20" align="center"><%=rs("pic_body")%></td>
</tr>
</table>
</td>
<%
if b mod 6=0 then response.write "<tr>"
rs.movenext
next
%>
</tr>
</table>
</div>
<div align="center">
<table border="0" width="768" cellpadding="0" style="border-collapse: collapse" id="table3">
<tr>
<td>
<table border="0" width="768" cellpadding="0" style="border-collapse: collapse" id="table4">
<tr>
<td width="184">
<p align="right">共<%=rs.recordcount%>张/每页<%=rs.pagesize%>张</td>
<%
if pic_page> 1 then
%>
<td width="39"><a href="show_pic.asp?pic_page=1">
<span style="text-decoration: none">首页</span></a></td>
<td width="72">
<a href="show_pic.asp?pic_page=<%=pic_page-1%>">
<span style="text-decoration: none">上一页</span></a></td>
<%
end if
%>
<%
if pic_page<>rs.pagecount then
%>
<td width="72"><a href="show_pic.asp?pic_page=<%=pic_page+1%>">
<span style="text-decoration: none">下一页</span></a></td>
<td width="88">
<a href="show_pic.asp?pic_page=<%=rs.pagecount%>">
<span style="text-decoration: none">最后一页</span></a></td><%end if%>
<td width="153">共<%=rs.pagecount%>/当前<%=pic_page%></td>
<form method="POST" action="">
<td width="49">请选择</td>
<td width="104">
<p align="right">
<select size="1" name="select" onchange="javascript:location=this.options[this.selectedIndex].value;">
<option value="第<%=pic_page%>页">第<%=pic_page%>页</option>
<%for c=1 to rs.pagecount%>
<%if c<>pic_page then%>
<option value="show_pic.asp?pic_page=<%=c%>">第<%=c%>页</option>
<%end if%>
<%next%>
</select>
</td>
</form>
</table>
</td>
</tr>
</table>
</div>