| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 550 人关注过本帖
标题:ASP分页代码出错
只看楼主 加入收藏
swalia
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2006-4-16
收藏
 问题点数:0 回复次数:1 
ASP分页代码出错

set rshotel=server.createobject("adodb.recordset")
sqltext="select * from hotelb where 市 like '%"&shucity&"%'"
if request.form("en")<>1 then
sqltext="select * from hotelb where 市 like '%"&shucity&"%' and 宾馆 like '%"&hotelname&"%'"
else
sqltext="select * from hotelb where 市 like '%"&shucity&"%' and 英文名 like '%"&hotelname&"%'"
end if

if request.form("cotytype")<>""then
sqltext="select * from hotelb where 所属地段 like '%"&cotytype&"%'"
end if
if Star="" then
else
sqltext=sqltext &"and ( "
if Star=0 then
sqltext=sqltext &" 星级='无标准' or"
end if
if Star=1 then
sqltext=sqltext &" 星级='一星级' or 星级='准一星级' or"
end if
if Star=2 then
sqltext=sqltext &" 星级='二星级' or 星级='准二星级' or"
end if
if Star=3 then
sqltext=sqltext &" 星级='三星级' or 星级='准三星级' or"
end if
if Star=4 then
sqltext=sqltext &" 星级='四星级' or 星级='准四星级' or"
end if
if Star=5 then
sqltext=sqltext &" 星级='五星级' or 星级='准五星级' or"
end if
sqltext=sqltext & " 星级='其他')"
end if


sqltext=sqltext & "order by id desc"
rshotel.open sqltext,conn,1,2
dim MaxPerPage
MaxPerPage=10

dim text,checkpage
text="0123456789"
rshotel.PageSize=MaxPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next

If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not rshotel.eof Then rshotel.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if

'call showpages
call list

If rshotel.recordcount > MaxPerPage then
end if

'显示帖子的子程序
Sub list() %>
<%
if not rshotel.eof then
i=0
do while not rshotel.eof
c_name=rshotel("宾馆")
set rsroom=server.createobject("adodb.recordset")
sqltext="select top 3 * from roomb where 宾馆='"&c_name&"'"

if jiage="all" then
else
sqltext=sqltext & " and ( "
if jiage<>"" then
sqltext=sqltext & jiage &" or "
end if
sqltext=sqltext & " breakfast='其他')"
end if

sqltext=sqltext & " order by id asc"
rsroom.open sqltext,conn
%>
<%if not rsroom.eof then
do while not rsroom.eof%>
<%
rsroom.movenext
loop
rsroom.close
end if%>
<%
i=i+1
if i >= MaxPerpage then exit do
rshotel.movenext
loop
end if
%>
<%
Response.write "<strong><font color='#000000'>-> 全部-</font>"
Response.write "共</font>" & "<font color=#FF0000>" & Cstr(rshotel.RecordCount) & "</font>" & "<font color='#000000'>个会员</font></strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
Response.write "<strong><font color='#000000'>第</font>" & "<font color=#FF0000>" & Cstr(CurrentPage) & "</font>" & "<font color='#000000'>/" & Cstr(rshotel.pagecount) & "</font></strong>&nbsp;"
If currentpage > 1 Then
response.write "<strong><a href='?&page="+cstr(1)+"&Star="&Star&"&city="&request("city")&"&starttime="&StartDate&"&deptime="&DepDate&"&jiage="&jiage&"'><font color='#000000'>首页</font></a><font color='#ffffff'> </font></strong>"
Response.write "<strong><a href='?page="+Cstr(currentpage-1)+"&Star="&Star&"&city="&request("city")&"&starttime="&StartDate&"&deptime="&DepDate&"&jiage="&jiage&"'><font color='#000000'>上一页</font></a><font color='#ffffff'> </font></strong>"
Else
Response.write "<strong><font color='#000000'>上一页 </font></strong>"
End if
If currentpage < rshotel.PageCount Then
Response.write "<strong><a href='?page="+Cstr(currentPage+1)+"&Star="&Star&"&city="&request("city")&"&starttime="&StartDate&"&deptime="&DepDate&"&jiage="&jiage&"'><font color='#000000'>下一页</font></a><font color='#ffffff'> </font>"
Response.write "<a href='?page="+Cstr(rshotel.PageCount)+"&Star="&Star&"&city="&request("city")&"&starttime="&StartDate&"&deptime="&DepDate&"&jiage="&jiage&"'><font color='#000000'>尾页</font></a></strong>&nbsp;&nbsp;"
Else
Response.write ""
Response.write "<strong><font color='#000000'>下一页</font></strong>&nbsp;&nbsp;"
End if
'response.write "</td><td align='right'>"
'response.write "<font color='#000000' >转到:</font><input type='text' name='page' size=4 maxlength=4 class=smallInput value="&Currentpage&">&nbsp;"
'response.write "<input class=buttonface type='submit' value='Go' name='cndok'>&nbsp;&nbsp;"
%>
<%

End sub
rshotel.close
conn.close
%>
帮我看看哪里出错,为什么我在点击下一页时出现空白?

搜索更多相关主题的帖子: ASP like hotelb 
2007-01-11 09:40
hehe365
Rank: 1
等 级:新手上路
帖 子:103
专家分:0
注 册:2006-10-20
收藏
得分:0 
数据连接和分页前处理
set conn=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
conn.open "driver={sql server};server=10.8.44.59;database=database;uid=sa;pwd="
sql="select * from sales"
rs.open sql,conn,1,1
rs.pagesize=5
pgcount=clng(rs.pagecount)
if cint(request("page"))=0 then
page=1
else
page=cint(request("page"))
end if
dim t,s
t=cint(page-1)
s=cint(page+1)
实现分页
response.Write "第"& page &"页"
response.Write "共"& pgcount &"页"

if page>1then
response.Write "<a href='test.asp?page=1'>第一页</a>"&""
else
response.write "第一页"&""
end if
if page>=2then
response.Write "<a href='test.asp?page=" & t & "'>上一页</a>"&""
else
response.write "上一页"&""
end if
if clng(page)<clng(pgcount) then
response.Write "<a href='test.asp?page=" & s & "'>下一页</a>"&""
else
response.write "下一页"&""
end if
if clng(page)>=clng(pgcount) then
response.write "最末页"&""
else
response.Write "<a href='test.asp?page=" & pgcount & "'>最末页</a>"&""
end if

2007-01-12 18:12
快速回复:ASP分页代码出错
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016650 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved