<%
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from guidedetail "
rs1.open sql1,conn,1,1
i=0
'response.Write(rs1.recordcount)
rs1.PageSize = 5
If Page < 1 Then Page = 1
If rs1.recordcount mod rs1.pagesize <> 0 then
pages =rs1.recordcount/rs1.pagesize
pages=cint(pages)+1
'response.Write(pages)
else If rs1.recordcount mod rs1.pagesize =0 then
pages = rs1.recordcount/rs1.pagesize
end if
end if
%>
pages是总共的页数
下面是显示数据库中的内容
<%
sql="select * from guidedetail "
set rs=conn.execute(sql)
%>
<%
Page=cint(Request("Page"))
If Page<1 then
Page=1
End if
If Page>pages then
Page=pages
End if
rs1.absolutepage=cint(page)
for j=1 to rs1.pagesize
if rs.eof then
exit for
end if
guideid=rs("id")%>
<tr>
<td width="5" bgcolor="#FF9900"> </td>
<td ><span class="STYLE2 STYLE2 STYLE2 STYLE2"><img src="images/circle2.gif" width="12" height="12" />
<a href="showguide.asp?id=<%=guideid%>"><%=rs("title")%> </a></span></td>
<td><span class="STYLE2 STYLE2 STYLE2"><%=rs("inputdate")%></span></td>
<td width="5" bgcolor="#FF9900"> </td>
<%rs.movenext%>
</tr>
<%
next
%>
<tr>
<td width="5" bgcolor="#FF9900"> </td>
<td colspan="2" align="right">
<span class="STYLE2">
<%If Page=1 then
response.Write("首页 ")
else
Response.Write("<a href=guide.asp?Page=1>首页 </a>")
End if
If Page>1 then
Response.Write("<a href=guide.asp?Page="&Page-1&">上一页 </a>")
End if
If Page<pages then
Response.Write("<a href=guide.asp?Page="&Page+1&">下一页 </a>")
End if
If Page=pages then
response.Write("尾页 ")
else
Response.Write("<a href=guide.asp?Page="&pages&">尾页 </a>")
End if%>
第<font color=#FF0000><%=page%>页,共<%=pages%>页 </span></td>
<td width="5" bgcolor="#FF9900"> </td>
</tr>
[此贴子已经被作者于2007-11-19 15:44:30编辑过]