<% const MaxPerPage=6 '单独页最大记录数 const 用来申明常量 dim sql dim rs dim totalPut '总记录 dim CurrentPage '当前页次 dim TotalPages '总页数 dim i %> <% set rs=server.createobject("adodb.recordset") sql="select * from book where shenhe=1 order by istop,id desc" rs.open sql,conn,1,1 dim filename filename="index.asp" %>
 
<% if rs.eof and rs.bof then %>
暂时还没有任何留言!
<% response.end end if %> <% if not rs.eof then rs.MoveFirst '注意放到前面来,否则到任何页总是在第一个记录上 end if rs.pagesize=MaxPerPage '设置每页最多显示多少条记录 If trim(Request("Page"))<>"" then '如果请求的页次不为空 CurrentPage= CLng(request("Page")) 'clng是转换成长整型数据类型,并赋值到当前页次上 If CurrentPage> rs.PageCount then '如果当前页次大于总页数,则将最大页次赋值到当前页次上 CurrentPage = rs.PageCount End If Else CurrentPage= 1 '一切条件不成立,将当前页设为第一页 End If totalPut=rs.recordcount '将总记录赋值于TOTALPUT if CurrentPage<>1 then '如果当前页数不等于第一页 if (currentPage-1)*MaxPerPage <% id=(totalPut-MaxPerPage*(currentPage-1))+1 i=0 Do While Not rs.EOF and i
第<%=id%>位
<%=rs("time")%>
QQ:<%=rs(" width="18" height="18">
来自:<%=rs(" width="18" height="18">
IP:<%=rs(" width="18" height="18">
 
" width="32" height="32">
<%=rs("name")%>
" width="20" height="20">
<%if rs("show")=2 then response.write"此留言内容为悄悄话,只有管理员才可查看!" %> <%else%> <%=rs("title")%> <%if rs("istop")<>9 then response.write ""&"[置顶]"&""%>
<%=rs("content")%> <%end if%>
<% if rs("reply")<>"" then%>
-----------------------------------------------------------------------------------------------------
站长回复:<%=rs("reply")%>
<%end if%>

<% i=i+1 rs.movenext loop %>
当前第<%=currentpage%>页 总共<%=n%>页 共<%=rs.recordcount%>个留言 <%k=currentPage if k<>1 then response.write "["+"首页] " response.write "["+"上一页] " else Response.Write "[首页] [上一页]" end if if k<>n then response.write "["+"下一页] " response.write "["+"尾页] " else Response.Write "[下一页] [尾页]" end if %> 管理留言

<% rs.close set rs=nothing conn.close set conn=nothing %>