asp 列表页循环
<%setrs=server.createobject("adodb.recordset")sql=sql&"orderbydatDesc"'response.write...
<%
set rs=server.createobject("adodb.recordset")
sql = sql &" order by dat Desc"
'response.write sql
rs.open sql,conn,1,1
if rs.eof and rs.bof then %>
<p align="center">打开错误或者暂时没合适的房源!</p>
<% else
rs.pagesize=30
totalPut=rs.recordcount '记录总数
totalPage=rs.pagecount
MaxPerPage=rs.pagesize
if currentpage<1 then
currentpage=1
end if
if currentpage>totalPage then
currentpage=totalPage
end if
if currentPage=1 then
showpages
showContent
showpages1
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark '移动到开始显示的记录位置
showpages
showContent
showpages1
else
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
sub showContent
dim i,j
%>
<br>
<% If rs("num")="" Then %>
<%=rs("zid")%>
<% Else %>
<%= rs("num") %>
<% End If %>
<a href="show.asp?zid=<%= rs.Fields.Item("zid").Value %>&typeto=<%= typeto %>" >[<%=(rs.Fields.Item("Diduan").Value)%>]<%=(rs.Fields.Item("Xiaoqm").Value)%><br>
</span><%=(rs.Fields.Item("fwsx").Value)%> /<%=(rs.Fields.Item("Taox").Value)%>/<%=(rs.Fields.Item("Mianj").Value)%>平米<br> <%=(rs.Fields.Item("Changq").Value)%>/
<% If typeto="sale" Then
response.Write("价 格")
else
response.Write("租 金")
end if %>
<%=(rs.Fields.Item("Jiag").Value)%><%=(rs.Fields.Item("fangshi").Value)%><%=(rs.Fields.Item("Dat").Value)%><br>
</a>
<hr>
<a href="show.asp?zid=<%= rs.Fields.Item("zid").Value %>&typeto=<%= typeto %>" > </a><a href="show.asp?zid=<%= rs.Fields.Item("zid").Value %>&typeto=<%= typeto %>" ></a><a href="show.asp?zid=<%= rs.Fields.Item("zid").Value %>&typeto=<%= typeto %>" > </a>
<% i=1
do while not (rs.eof or err)%>
<%
if i>=MaxPerPage then exit do '循环时如果到尾部则先退出,如果记录达到页最大显示数,也退出
i=i+1
rs.movenext
loop
%>
<%end sub %>
怎么不循环了,在线等,HI在线! 展开
set rs=server.createobject("adodb.recordset")
sql = sql &" order by dat Desc"
'response.write sql
rs.open sql,conn,1,1
if rs.eof and rs.bof then %>
<p align="center">打开错误或者暂时没合适的房源!</p>
<% else
rs.pagesize=30
totalPut=rs.recordcount '记录总数
totalPage=rs.pagecount
MaxPerPage=rs.pagesize
if currentpage<1 then
currentpage=1
end if
if currentpage>totalPage then
currentpage=totalPage
end if
if currentPage=1 then
showpages
showContent
showpages1
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark '移动到开始显示的记录位置
showpages
showContent
showpages1
else
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
sub showContent
dim i,j
%>
<br>
<% If rs("num")="" Then %>
<%=rs("zid")%>
<% Else %>
<%= rs("num") %>
<% End If %>
<a href="show.asp?zid=<%= rs.Fields.Item("zid").Value %>&typeto=<%= typeto %>" >[<%=(rs.Fields.Item("Diduan").Value)%>]<%=(rs.Fields.Item("Xiaoqm").Value)%><br>
</span><%=(rs.Fields.Item("fwsx").Value)%> /<%=(rs.Fields.Item("Taox").Value)%>/<%=(rs.Fields.Item("Mianj").Value)%>平米<br> <%=(rs.Fields.Item("Changq").Value)%>/
<% If typeto="sale" Then
response.Write("价 格")
else
response.Write("租 金")
end if %>
<%=(rs.Fields.Item("Jiag").Value)%><%=(rs.Fields.Item("fangshi").Value)%><%=(rs.Fields.Item("Dat").Value)%><br>
</a>
<hr>
<a href="show.asp?zid=<%= rs.Fields.Item("zid").Value %>&typeto=<%= typeto %>" > </a><a href="show.asp?zid=<%= rs.Fields.Item("zid").Value %>&typeto=<%= typeto %>" ></a><a href="show.asp?zid=<%= rs.Fields.Item("zid").Value %>&typeto=<%= typeto %>" > </a>
<% i=1
do while not (rs.eof or err)%>
<%
if i>=MaxPerPage then exit do '循环时如果到尾部则先退出,如果记录达到页最大显示数,也退出
i=i+1
rs.movenext
loop
%>
<%end sub %>
怎么不循环了,在线等,HI在线! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询