ASP分页,只有第一页能显示,第二页显示为空页面,其它页面也显示不了。 20

<%setrs=server.createobject("adodb.recordset")rs.open"select*from[second_hand]wherees... <%set rs=server.createobject("adodb.recordset")

rs.open "select * from [second_hand] where estate=1 "&tj7&" "&tj8&" "&tj9&" "&tj10&" "&tj11&" "&tj12&" "&tj13&" "&tj1&" "&tj2&" "&tj3&" "&tj4&" "&tj5&" "&tj6&" "&province_tj&" and 1=1 order by "&order&" ",conn,1,1 ‘多条件查询

if rs.recordcount=0 then
else
rs.PageSize =40 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount
page=request("page")

if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if

if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if

rs.AbsolutePage=Page

if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if
%>

<% for i= 1 to x
%> ’后面循环显示查询到的数据

<%
rs.movenext
next
call PageControl(iCount,maxpage,page,"border=0 align=right","<p align=right>")
end if

rs.close
set rs=nothing
Sub PageControl(iCount,pagecount,page,table_style,font_style)
'生成上一页下一页链接
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")

query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next

Response.Write("<table " & Table_style & ">" & vbCrLf )
Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR>" & vbCrLf )
Response.Write("<TD align=right>" & vbCrLf )
Response.Write(font_style & vbCrLf )

if page<=1 then
Response.Write ("上页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">上页</A> " & vbCrLf)
end if

if page>=pagecount then
Response.Write ("下页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下页</A> " & vbCrLf)
end if

Response.Write(" 页次:" & page & "/" & pageCount & "页" & vbCrLf)
Response.Write(" 共有" & iCount & "条信息" & vbCrLf)
Response.Write("</TD>" & vbCrLf )
Response.Write("</TR></form>" & vbCrLf )
Response.Write("</table>" & vbCrLf )
End Sub
%>

程序分页显示其它数据都正常。感觉应该是数据没有传递到第二页。
展开
 我来答
DOTA1205
2011-02-25
知道答主
回答量:12
采纳率:0%
帮助的人:7.4万
展开全部
首先看看数据库中有多少条记录,是不是可以分页,然后你单击下一页的时候看看page是不是能传值,如果还不行的话,我这有段分页代码,你看下是否可行!
//////////////////////分页显示内容部分/////////////////////////////////////////
<%
function showpage(totalnumber,listnum,filename)
dim n
if totalnumber mod listnum=0 then
n=totalnumber \ listnum
else
n=totalnumber \ listnum + 1
end if
response.write "<form method=post action="&filename&">"
response.write " "
if CurrentPage<2 then
response.write "<font color='#000080'>首页 上一页</font> "
else
response.write "<a href="&filename&"?page=1>首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&">上一页</a> "
end if
if n-currentpage<1 then
response.write "<font color='#000080'>下一页 尾页</font>"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&">下一页</a> "
response.write "<a href="&filename&"?page="&n&">尾页</a>"
end if
response.write "<font color='#000080'> 共<b>"&totalnumber&"</b>条留言 每页<b>"&listnum&"</b>条留言</font> "
response.write "<font color='#000080'>转到:</font><input class=smallInput type='text' name='page' size=4 maxlength=10 value="&Currentpage&">"
response.write "<input class=buttonface type='submit' value='Go' name='cndok'></form>"
end function %>

//////////////////////定义和处理分页部分////////////////////////////////
<%
dim totalPut'总记录数
dim CurrentPage'当前页
dim TotalPages'总页数
dim a,j
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
%>
<%
sql="select * from guest order by id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<p align=center>还 没 有 任 何 留 言</p>"
else
totalPut=rs.recordcount //
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*listnum>totalput then
if (totalPut mod listnum)=0 then
currentpage=totalPut \ listnum
else
currentpage=totalPut \ listnum + 1
end if
end if
if currentPage=1 then
showContent '显示留言函数
showpage totalput,listnum,"index.asp"'显示分页函数
else
if (currentPage-1)*listnum<totalPut then
rs.move (currentPage-1)*listnum

showContent
showpage totalput,listnum,"index.asp"
else
currentPage=1
showContent
showpage totalput,listnum,"index.asp"
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
%>
家有小多多
2011-02-25 · TA获得超过467个赞
知道答主
回答量:421
采纳率:0%
帮助的人:0
展开全部
const maxperpage=10
rs.pagesize=maxperpage

'总记录数,直接得到
totalput=rs.recordcount

'总页数,计算得到
if (totalput mod maxperpage = 0) then
n=totalput \ maxperpage
else
n=totalput \ maxperpage + 1
end if

'当前页的确定
if request("page")="" then
currentpage=1
else
currentpage=clng(request("page"))
if currentpage>n then
currentpage=n
end if
end if

if CurrentPage<>1 then
if (currentPage-1)*MaxPerPage<totalPut then
rs.move(currentPage-1)*MaxPerPage
end if
end if

response.write totalput
k=currentPage
if k<>1 then
response.write "[<b>"+"<a href='?page=1'>首页</a></b>] "
response.write "[<b>"+"<a href='?page="+cstr(k-1)+"'>上一页</a></b>] "
else
Response.Write "[首页] [上一页]"
end if
if k<>n then
response.write "[<b>"+"<a href='?page="+cstr(k+1)+"'>下一页</a></b>] "
response.write "[<b>"+"<a href='?page="+cstr(n)+"'>尾页</a></b>] "
else
Response.Write "[下一页] [尾页]"
end if

%>
有些代码要自己修改下要是有帮助要记得加分哦
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
匿名用户
2011-02-28
展开全部
你应该看一下你SQL语句中在page到下一页是他所需要的参数是不是没有传递过来!
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式