翻页问题.急
<%
dim rssql2,PageSize,RowCount,TotalPages,PageNo,Position,PageBegin,PageEnd
set conn = server.CreateObject( "ADODB.connection ")
set rs= server.CreateObject( "ADODB.RecordSet ")
conn.open( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= "&server.MapPath( "zhongzhong.asp "))
fwlb = Trim(Request( "fwlb "))
ld = Trim(Request( "ld "))
hx = Trim(Request( "hx "))
fj = Trim(Request( "fj "))
qy = Trim(Request( "qy "))
s = " "
If fwlb <> " " Then
s = s & " AND fwlb like '% " & fwlb & "% ' "
End If
If ld <> " " Then
s = s & " AND ld like '% " & ld & "% ' "
End If
If hx <> " " Then
s = s & " AND hx like '% " & hx & "% ' "
End If
If fj <> " " Then
s = s & " AND fj = ' " & fj & " ' "
End If
If qy <> " " Then
s = s & " AND qy like '% " & qy & "% ' "
End If
rssql2 = "SELECT * FROM house WHERE sfsh= '是 ' and 1=1 " & s
rs.open rssql2,conn,3,3
PageSize=20
PageSize=20
If rs.RecordCount=0 then
%>
<%
else
rs.PageSize = Cint(PageSize)
TotalPages=rs.PageCount
PageNo=Request.QueryString( "PageNo ")
if PageNo= " " or PageNo <1 Then
PageNo = 1
end if
rs.AbsolutePage = PageNo
Position=rs.PageSize*PageNo
PageBegin=Position-rs.PageSize+1
if Position <rs.RecordCount then
PageEnd=Position
else
PageEnd= rs.RecordCount
end if
%>
<TABLE WIDTH=529 BORDER=0 CELLPADDING=1 CELLSPACING=1 style= 'font-size:9pt '>
<%
Response.Write "页 "& PageNo & " / "& TotalPages & " |记录 "& PageBegin & " - " & PageEnd & " / " &rs.RecordCount
%>
<TR bgcolor=#003366 height=20px>
<tr >
<td width= "59 " > 类别 </td>
<td width= "87 " > 区域 </td>
<td width= "73 "> 路段 </td>
<td width= "73 " > 户型 </td>
<td width= "73 " > 价位 </td>
<td width= "145 " > 查看详情 </td>
</tr>
</TR>
<%
RowCount = rs.PageSize
dim color1,color2
color1= "#dddddd "
color2= "#eeeeee "
Do While Not rs.EOF and RowCount > 0
Response.Write " <TR height=20px bgcolor= "
%>
<%
if RowCount mod 2=0 then:response.write color1 else:response.write color2
%>
<%
Response.Write "> "
%>
<td > <%=rs( "fwlb ")%> </td>
<td> <%=rs( "qy ")%> </td>
<td> <%=left(rs( "ld "),8)%> </td>
<td> <%=rs( "hx ")%> </td>
<td> <%=rs( "fj ")%> </td>
<td> <a href=fwxx.asp?id= <%=trim(rs( "id "))%> class= "linkone "> 查看详情 </a> </td>
</tr>
</TR>
<%
RowCount = RowCount - 1
rs.MoveNext
Loop
conn.Close
set rs = nothing
set conn = nothing
%>
<%
For i=1 to TotalPages
if CInt(PageNo) = CInt(i) then
response.write "[ "&i& "] "
else
response.write "  <a href=qtqk.asp?PageNo= "&i& "> "&i& " </a>   "
end if
Next
%>
</TABLE>
<%
End if
%>
</table>
查询的时候可以实现!我搜索全部的时候翻页可以不出错!可是当我选择其中一个条件后第一页显示正确,可是点第二页的时候就会出错!高手们帮帮忙!
[解决办法]
下面的是动网的翻页代码~!
楼主可以参考一下~!
<%
Dim Searchstr
Searchstr = "?userSearch= " & Request( "userSearch ") & "&username= " & Request( "username ") & "&useremail= " & Request( "useremail ") & "&homepage= " & Request( "homepage ") & "&oicq= " & Request( "oicq ") & "&icq= " & Request( "icq ") & "&msn= " & Request( "msn ") & "&lastip= " & Request( "lastip ") & "&usertitle= " & Request( "usertitle ") & "&sign= " & Request( "sign ") & "&userclass= " & Request( "userclass ") & "&usergroups= " & Request( "usergroups ") & "&action= " & Request( "action ") & "&usergroupid= " & Request( "usergroupid ") & "&loginR= " & Request( "loginR ") & "&loginT= " & Request( "loginT ") & "&vanishR= " & Request( "vanishR ") & "&vanishT= " & Request( "vanishT ") & "®R= " & Request( "regR ") & "®T= " & Request( "regT ") & "&artcleR= " & Request( "artcleR ") & "&artcleT= " & Request( "artcleT ") & "&searchmax= " & Request( "searchmax ") & "&UVipStarTime= " & Request( "UVipStarTime ") & "&UVipStarTime_value= " & Request( "UVipStarTime_value ") & "&UVipEndTime= " & Request( "UVipEndTime ") & "&UVipEndTime_value= " & Request( "UVipEndTime_value ")
if currentpage > 4 then
response.write " <a href= " " "&Searchstr& "&page=1 " "> [1] </a> ... "
end if
if Pcount> currentpage+3 then
endpage=currentpage+3
else
endpage=Pcount
end if
for i=currentpage-3 to endpage
if not i <1 then
if i = clng(currentpage) then
response.write " <font color=red> [ "&i& "] </font> "
else
response.write " <a href= " " "&Searchstr& "&page= "&i& " " "> [ "&i& "] </a> "
end if
end if
next
if currentpage+3 < Pcount then
response.write "... <a href= " " "&Searchstr& "&page= "&Pcount& " " "> [ "&Pcount& "] </a> "
end if
%>
[解决办法]
在你点第二页的时候页面刷新重新提交,搜过条件已改变
[解决办法]
up
[解决办法]
response.write "  <a href=qtqk.asp?PageNo= "&i& "> "&i& " </a>   "
在这一句要加上 fwlb lb hx fj qy 参数....