set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,1
if rs.eof and rs.bof then
response.write "
1<p align="center"> 没有找到您需要的商品,请检查关键字。</p>
"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showpage totalput,MaxPerPage,"query.asp"
showContent
showpage totalput,MaxPerPage,"query.asp"
else
if (currentPage-1)*MaxPerPage
1<totalput %="" (currentpage-1)*maxperpage="" bookmark="rs.bookmark" conn="nothing" conn.close="" currentpage="1" dim="" else="" end="" i="0" if="" rs="nothing" rs.close="" rs.move="" set="" showcontent="" showpage="" sub="" then="" totalput,maxperpage,"query.asp"="">
2<div align="center"><center><table bgcolor="#F0F8FF" border="1" bordercolordark="#ECF5FF" bordercolorlight="#4DA6FF" cellspacing="0" width="94%">
3<tr>
4<td align="center" bgcolor="#0080C0" height="20" width="15%"><font color="#FFFFFF"><strong>定货号</strong></font></td>
5<td align="center" bgcolor="#0080C0" width="12%"><font color="#FFFFFF"><strong>商品名称</strong></font></td>
6<td align="center" bgcolor="#0080C0" width="12%"><font color="#FFFFFF"><strong>规格</strong></font></td>
7<td align="center" bgcolor="#0080C0" width="25%"><font color="#FFFFFF"><strong>报价</strong></font></td>
8</tr>
do while not rs.eof
1<tr>
2<td height="23" width="20%"><p align="center">```
3=rs("md_goodsno")
4```</p></td>
5<td width="40%">```
6=rs("md_goodsname")
7```</td>
8<td width="20%">```
9=rs("md_goodsstyle")
10```</td>
11<td width="20%">```
12=rs("md_standprice")
13```</td>
14</tr>
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
1</table>
2</center></div>```
3
4end sub
5
6function showpage(totalnumber,maxperpage,filename)
7dim n
8dim tempquery
9if totalnumber mod maxperpage=0 then
10n= totalnumber \ maxperpage
11else
12n= totalnumber \ maxperpage+1
13end if
14response.write "<form action="&amp;filename&amp;" method="Post">"
15response.write "<p align="center">&gt;&gt;分页 "
16if CurrentPage&lt;2 then
17response.write "<font color="999966">首页 上一页</font> "
18else
19response.write "<a ?page="1&amp;" href="&amp;filename&amp;">首页</a> "
20response.write "<a ?page="&amp;CurrentPage-1&amp;" href="&amp;filename&amp;">上一页</a> "
21end if
22if n-currentpage&lt;1 then
23response.write "<font color="999966">下一页 尾页</font>"
24else
25response.write "<a ?page="&amp;(CurrentPage+1)
26response.write " href="&amp;filename&amp;">下一页</a> <a ?page="&amp;n&amp;" href="&amp;filename&amp;">尾页</a>"
27end if
28response.write " 页次:<strong><font color="red">"&amp;CurrentPage&amp;"</font>/"&amp;n&amp;"</strong>页 "
29response.write " 共<b>"&amp;totalnumber&amp;"</b>种商品 <b>"&amp;maxperpage&amp;"</b>种商品/页 "
30response.write " 转到:<input class="smallInput" maxlength="10" name="page" size="4" type="text" value="¤tpage&amp;"/>"
31response.write "<input class="buttonface" name="cndok" type="submit" value="转到"/></p></form>"
32
33end function
34
35
上述代码,用QUERY.ASP?PAGE=1&QUERYTEXT=AA可以显示结果,但是用别的HTM后可以查询.
第一页显示正常,单击后一页后,就把整个数据库给显示了,是什么问题啊
---------------------------------------------------------------
因为你没有把查询条件传给下一页!QUERYTEXT=AA
response.write "<a &querytext=" & 查询条件
response.write " ?page="&(CurrentPage+1) & " href="&filename&">下一页 <a &querytext=" & 查询条件 & " ?page="&n & " href="&filename&">尾页"
---------------------------------------------------------------
注意把获得的所有的参数都往下传
---------------------------------------------------------------
楼上对的
如果还不明白,把给sql赋值附近的代码贴出来
---------------------------------------------------------------
是的,注意你往下页传的的参数