如何在asp页面分页显示数据库信息

这是个循环显示数据库liuyan表的信息。但不知道怎么做分页显示,希望有人能帮我写分页显示的代码或教我怎么做分页显示数据库的信息,因为我不单只这个页面要分页显示。本人QQ... 这是个循环显示数据库liuyan表的信息。但不知道怎么做分页显示,希望有人能帮我写分页显示的代码或教我怎么做分页显示数据库的信息,因为我不单只这个页面要分页显示。本人QQ:445375388
<!-- #include file="mdb.asp" -->
<body>
<%on error resume next%>
<table width="586" height="576" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top" background="images/1.jpg">
<table width="586" height="576" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top"><br>留言<hr width="95%">
<%
set rst=server.createobject("adodb.recordset")
rst.open "select * from liuyan order by l_uid desc",conn,1.1
dim uid
uid=request.querystring("uid")
if request.querystring("act")="shanchu" then
set rst1=server.createobject("adodb.recordset")
rst1.open "select * from liuyan where l_uid="&uid,conn,1,3
rst1.delete
rst1.close
response.Redirect("liuyan.asp")
'response.write("留言删除成功")
end if
while not rst.eof
%>
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="71%"> <%response.write("用户:" & rst("l_id"))%></td>
<td width="29%" align="right"><%=rst("l_sj")%> </td>
</tr>
<tr>
<td colspan="2" align="left" valign="top">    
<%response.write("说:" & rst("l_ly"))%></td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td align="right"><%if session("ID")="hwbshuaige134" then%>
<a href="liuyan.asp?act=shanchu&uid=<%=rst("l_uid")%>" target="kj" class="STYLE1">删除</a>
<%end if%></td>
</tr>
</table>
<hr align="center" width="95%" size="1" color="#33CCFF" id="1">
<%
rst.movenext
wend
rst.close
%> </td>
</tr>
<tr>
<%
if request.querystring("act")="tijiao" then
if not session("acc") then
response.write("请先登录")
else
rst.open "liuyan",conn,1,3
rst.addnew
rst("l_id")=session("ID")
rst("l_sj")=now
rst("l_ly")=request.form("b_ly")
rst.update
rst.close
if err.number>0 then
response.write("留言不能为空")
else
response.Redirect("liuyan.asp")
'response.write("留言提交成功")
end if
end if
end if
%>
<td height="150" align="center" valign="top">在此写留言<br>
<form name="form1" method="post" action="liuyan.asp?act=tijiao">
<p>
<textarea name="b_ly" cols="75" rows="5" id="b_ly"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="提交">
</p>
</form></td>
</tr>
</table></td>
</tr>
</table>
<%
set rst=nothing
conn.close
set conn=nothing
%>
</body>
展开
 我来答
rocket80929
推荐于2016-06-14 · TA获得超过580个赞
知道小有建树答主
回答量:878
采纳率:0%
帮助的人:580万
展开全部
<html>

<!-- #include file="mdb.asp" -->
<body>
<%on error resume next%>
<table width="586" height="576" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top" background="images/1.jpg">
<table width="586" height="576" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top"><br>留言<hr width="95%">
<%
set rst=server.createobject("adodb.recordset")
rst.open "select * from liuyan order by l_uid desc",conn,1.1
dim uid
uid=request.querystring("uid")
if request.querystring("act")="shanchu" then
set rst1=server.createobject("adodb.recordset")
rst1.open "select * from liuyan where l_uid="&uid,conn,1,3
rst1.delete
rst1.close
response.Redirect("liuyan.asp")
'response.write("留言删除成功")
end if %>

<table width="90%" border="0" cellspacing="0" cellpadding="0">

<% If not rst.eof Then
tol=rst.recordcount
shownum=15
rst.pagesize=shownum
maxpage=rst.pagecount
requestpage=clng(request("p"))
if requestpage="" or requestpage<1 then
requestpage=1
end if
if requestpage>maxpage then
requestpage=maxpage
end if
if not requestpage=1 then
rst.move (requestpage-1)*rst.pagesize
end if
for i=1 to rst.pagesize and not rst.eof

%>
<tr>
<td width="71%"> <%response.write("用户:" & rst("l_id"))%></td>
<td width="29%" align="right"><%=rst("l_sj")%> </td>
</tr>
<tr>
<td colspan="2" align="left" valign="top">
<%response.write("说:" & rst("l_ly"))%></td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td align="right"><%if session("ID")="hwbshuaige134" then%>
<a href="liuyan.asp?act=shanchu&uid=<%=rst("l_uid")%>" target="kj" class="STYLE1">删除</a>
<%end if%></td>
</tr>
<%
rst.movenext
if rst.eof then exit for
next
else
response.Write("没有您要查询的信息!")
end if

%>
</table>
<table width="90%" border="0" align="center">
<tr>

<td valign="top">
<div align="center"><span style="font-size: 9pt">共<%=tol %>条记录 共<font color=red><%=maxpage%></font>页 第<%=requestpage%>页 <font color=666666>
<%if requestpage-1>0 then%>
<a href="<%=path%>?p=<%=requestpage-1%>" class="t9b">上一页</a>
<%else%>
上一页
<%end if%>
<%if requestpage+1<=maxpage then%>
<a href="<%=path%>?p=<%=requestpage+1%>" class="t9b">下一页</a>
<%else%>
下一页</font>
<%end if%>

</span>

</div></td>
</tr>
<%Rst.Close
Set Rst=Nothing%></table>
<hr align="center" width="95%" size="1" color="#33CCFF" id="1">
</td>
</tr>
<tr>
<%
if request.querystring("act")="tijiao" then
if not session("acc") then
response.write("请先登录")
else
rst.open "liuyan",conn,1,3
rst.addnew
rst("l_id")=session("ID")
rst("l_sj")=now
rst("l_ly")=request.form("b_ly")
rst.update
rst.close
if err.number>0 then
response.write("留言不能为空")
else
response.Redirect("liuyan.asp")
'response.write("留言提交成功")
end if
end if
end if
%>
<td height="150" align="center" valign="top">在此写留言<br>
<form name="form1" method="post" action="liuyan.asp?act=tijiao">
<p>
<textarea name="b_ly" cols="75" rows="5" id="b_ly"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="提交">
</p>
</form></td>
</tr>
</table></td>
</tr>
</table>
<%
set rst=nothing
conn.close
set conn=nothing
%>
</body>

</html>

试试这个
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式