asp分页显示

2025-01-07 19:31:51
推荐回答(3个)
回答1:

<%'分页显示
rs.pagesize=15‘每页显示数目
page=CLng(Request("page"))
NumRecord=rs.recordcount
NumPage=rs.pagecount
if page<1 then page=1
NowPage=page
rs.absolutepage=page
for i=1 to rs.pagesize
%>

回答2:





无标题文档
















<%
danwei=Request.form("danwei")
person=Request.form("person")
years=Request.form("years")
if request.form("danwei")="" and request.form("person")="" and request.form("years")="" then
response.write("请输入查询条件(可模糊查询)")
response.end
end if
%>

<%
set rs_news=server.createobject("adodb.recordset")
sqltext4="SELECT * from xiansuo where 1=1"
if danwei<>"" then
sqltext4=sqltext4 & "and danwei like '%"&danwei&"%'"
end if
if person<>"" then
sqltext4=sqltext4 & "and person like '%"&person&"%'"
end if
if years<>"" then
sqltext4=sqltext4 & "and years like '%"&years&"%'"
end if
rs_news.open sqltext4,conn,1,1
%>
<%
rsDetail.filter = aryRelKey(0, 1) & "='" & rs1(aryRelKey(0, 0)).value & "' and " & aryRelKey(1, 1) & "='" & rs1(aryRelKey(1, 0)).value & "'"
if (rsDetail.recordcount > 0) then
rsDetail.pageSize=Session("rptRecordsPerPage")
rsDetail.absolutePage = Session("rptDetailPageNo")
for i = 0 to Session("rptRecordsPerPage") - 1
%>













<%
rsDetail.movenext
if rsDetail.eof = true then
exit for
end if
next
else
Response.Write "
没有明细文件
"
end if
%>
收款单位 收款人 日期 票据 票据号码 收款项目 金额 账簿名称 年度 凭证号 备注
<%=rs_news.fields("danwei") %> <%=rs_news.fields("person") %> <%=rs_news.fields("dates") %> <%=rs_news.fields("piaoju") %> <%=rs_news.fields("piaojuno") %> <%=rs_news.fields("xiangmu") %> <%=rs_news.fields("money") %> <%=rs_news.fields("zhangbu") %> <%=rs_news.fields("years") %> <%=rs_news.fields("pingzheng") %> <%=rs_news.fields("beizhu") %>


回答3:





无标题文档
















<%
danwei=Request.form("danwei")
person=Request.form("person")
years=Request.form("years")
if request.form("danwei")="" and request.form("person")="" and request.form("years")="" then
response.write("请输入查询条件(可模糊查询)")
response.end
end if
%>

<%
set rs_news=server.createobject("adodb.recordset")
sqltext4="SELECT * from xiansuo where 1=1"
if danwei<>"" then
sqltext4=sqltext4 & "and danwei like '%"&danwei&"%'"
end if
if person<>"" then
sqltext4=sqltext4 & "and person like '%"&person&"%'"
end if
if years<>"" then
sqltext4=sqltext4 & "and years like '%"&years&"%'"
end if
set rs_news = Server.CreateObject("ADODB.RECORDSET")
rs_news.open sqltext4,conn,1,3
if rs_news.eof then
Response.write "没数据"
Response.end
end if
i=4 '定义每页显示数(分页)
rs_news.pagesize=i '定义每页现实数(分页) pagesize每页显示数
if request("page_no")="" then '获取页码并判断(分页)
page_no=1
else
page_no=Cint(request("page_no"))
end if
if page_no>rs_news.pagecount then
page_no=rs_news.pagecount
end if
rs_news.absolutepage=page_no
do while not rs_news.eof and not rs_news.bof and i > 0
i = i - 1
%>













<%
rs_news.movenext
loop
'这里写页数等信息,这个不用多说了吧。
rs_news.close
%>
收款单位 收款人 日期 票据 票据号码 收款项目 金额 账簿名称 年度 凭证号 备注
<%=rs_news.fields("danwei") %> <%=rs_news.fields("person") %> <%=rs_news.fields("dates") %> <%=rs_news.fields("piaoju") %> <%=rs_news.fields("piaojuno") %> <%=rs_news.fields("xiangmu") %> <%=rs_news.fields("money") %> <%=rs_news.fields("zhangbu") %> <%=rs_news.fields("years") %> <%=rs_news.fields("pingzheng") %> <%=rs_news.fields("beizhu") %>