大家帮忙,我想写一个BBS,假如果每页显示20条记录,超过20条后的记录显示到下一页,请问怎么处理
谢了!!!
Set rs=Server.CreateObject("ADODB.Recordset")
sql="Select * from 表名 "
rs.Open sql,Conn,1,1
rs.pagesize=20 ‘设置每页显示20条
If rs.eof and rs.bof then
rs.close
Set rs=Nothing
Conn.close
Set Conn=Nothing
response.write" <script language='javascript'> alert('无任何信息!'); history.go(-1);</script>"
<%
else
' 接收页数
Page=Clng(Request.QueryString("Page"))
If Page<1 then
Page=1
End if
If Page>rs.PageCount then
Page=rs.PageCount
End if
rs.AbsolutePage=Page '显示当前页数
for i=1 to rs.pagesize
if rs.Eof then
Exit for
End if
%>
<% rs.movenext
Next
end if
%>
<%
Response.Write("<table width=700 border=0 cellspacing=0 cellpadding=0 align=right >")
Response.Write("<tr>")
Response.Write("<td class=STYLE4>")
If Page=1 then
response.Write("首页 ")
else
Response.Write("<a href=order.asp?Page=1>首页 </a>")
End if
If Page=1 then
response.Write("上一页 ")
else
Response.Write("<a href=order.asp?Page="&Page-1&">上一页 </a>")
End if
If Page=rs.PageCount then
response.Write("下一页 ")
else
Response.Write("<a href=order.asp?Page="&Page+1&">下一页 </a>")
End if
If Page=rs.PageCount then
response.Write("尾页 ")
else
Response.Write("<a href=order.asp?Page="&rs.pagecount&">尾页 </a>")
End if
Response.Write("共<font color=#FF0000>"&rs.recordcount&"</font>条订单 共<font color=#FF0000>"&rs.pagecount&"</font>页")
Response.Write("</td>")
Response.Write("</tr>")
Response.Write("</table>")
%>
大体这样吧,具体情况,具体改!!!!!!
[此贴子已经被作者于2007-10-25 12:14:23编辑过]