十万火急,哪位帮找一下是哪儿的问题,解决马上结贴,不然这个月就白做了,555555

NetBoy 2003-12-27 09:44:42
查询+分页问题,只是组合时出了问题,哪位指点一下,分不够再加:

查询页面:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>查询页</title>

</head>

<body>
<FORM action="query.asp" method="post" name=main style="MARGIN: 4px">
<TABLE
width="400" border=0 align="center" cellPadding=2 cellSpacing=1>
<TBODY>
<TR>
<TD height=24 colspan="3" vAlign=center> <div align="center">-=<FONT
color=#0000ff>博洋信息查询</FONT>=-</div></TD>
</TR>
<TR>
<TD width="13%" height=24 vAlign=center>
<P align=center> </P></TD>
<TD height=24 colSpan=2> <font size="2">
<INPUT
type=radio CHECKED value=fy_cs name=cxlb>
<FONT
color=#000080>出售</FONT> 
<INPUT type=radio
value=fy_qg name=cxlb>
<FONT
color=#000080>求购</FONT> </font></TD>
</TR>
<TR>
<TD width="13%" height=24 vAlign=center>
<div align="center"><font size="2"></font></div></TD>
<TD height=24 colSpan=2> <font size="2">
<INPUT
type=radio value=fy_cz name=cxlb>
<FONT
color=#000080>出租</FONT> 
<INPUT type=radio
value=fy_qz name=cxlb>
<FONT
color=#000080>求租</FONT> </font></TD>
</TR>
<TR>
<TD width="13%" height=24 vAlign=center>
<P align=center><font size="2"><U>户型</U>:</font></P></TD>
<TD height=24 colSpan=2> <font size="2">
<select name="fwjg" size="1" id="select" style="background-color: #FFFFEE; color: #000080">
<option value="">不限</option>
<option value="单间">单间</option>
<option value="套间">套间</option>
<option value="单间+卫生间">单间+卫生间</option>
<option value="单间+厨房">单间+厨房</option>
<option value="单间+卫+厨">单间+卫+厨</option>
<option value="合租">合租</option>
<option value="一室一厅">一室一厅</option>
<option value="二室一厅">二室一厅</option>
<option value="二室二厅">二室二厅</option>
<option value="三室一厅">三室一厅</option>
<option value="三室二厅">三室二厅</option>
<option value="三室二厅二卫">三室二厅二卫</option>
<option value="四室一厅">四室一厅</option>
<option value="四室一厅二卫">四室一厅二卫</option>
<option value="四室二厅">四室二厅</option>
<option value="四室二厅二卫">四室二厅二卫</option>
<option value="五室二厅">五室二厅</option>
<option value="五室二厅二卫">五室二厅二卫</option>
<option value="错层">错层</option>
<option value="复式楼">复式楼</option>
<option value="其他">其他</option>
</select>
</font></TD>
</TR>
<TR>
<TD width="13%" height=24 vAlign=center>
<P align=center><font size="2"><U>区域</U>:</font></P></TD>
<TD height=24><select name="szqy" size="1" id="select2" style="background-color: #FFFFE6; color: #000080">
<option value="">不限</option>
<option value="金水区">金水区</option>
<option value="邙山区">邙山区</option>
<option value="中原区">中原区</option>
<option value="二七区">二七区</option>
<option value="管城区">管城区</option>
<option value="西开发区">西开发区</option>
<option value="东开发区">东开发区</option>
<option value="郑东新区">郑东新区</option>
<option value="上街区">上街区</option>
<option value="巩义">巩义</option>
<option value="登封">登封</option>
<option value="荥阳">荥阳</option>
<option value="新密">新密</option>
<option value="新郑">新郑</option>
<option value="中牟">中牟</option>
</select>
</TD>
<TD height=24></TD>
</TR>
<TR>
<TD width="13%"
height=24 align=middle>
<div align="center"><font size="2"><U>位置</U>:</font></div></TD>
<TD height=24 colSpan=2> <font size="2">
<INPUT name=dlwz id="dlwz"
size=11 maxlength="15">
(可按路名查询,如:黄河路)</font></TD>
</TR>
<TR>
<TD width="13%"
height=24 align=middle>
<div align="center"><font size="2"><U>面积</U>:</font></div></TD>
<TD height=24 colSpan=2> <font size="2">
<INPUT name=mj_min id="mj_min" value=0
size=4>

<INPUT
name=mj_max id="mj_max" value=9999 size=4>
(平方米)</font></TD>
</TR>
<TR>
<TD width="13%"
height=24 align=middle>
<div align="center"><font size="2"><U>价格</U>:</font></div></TD>
<TD width="31%" height=24> <font size="2">
<INPUT
name=jg_min id="jg_min" value=0 size=4>

<INPUT name=jg_max id="jg_max" value=9999 size=4>
</font></TD>
<TD width="56%" height=24><FONT
color=#ff0000 size="2">(租赁:元/月)<BR>
(买卖:<a href="../nbfbxx/nb_fbxx.asp">万元</a>)</FONT></TD>
</TR>
<TR>
<TD
height=24 colSpan=2 align=middle> <div align="right">
<font size="2">
<INPUT type=submit value=查询信息 name=B1>
<INPUT onclick="window.location.href='../nbfbxx/nb_fbxx.asp'" type=button value=发布信息 name=submit2>
</font></div></TD>
<TD
height=24 align=middle><div align="center"></div></TD>
</TR>
</TBODY>
</TABLE>
</FORM>
</body>
</html>
...全文
64 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
NetBoy 2003-12-28
  • 打赏
  • 举报
回复
我本来是想组合到一起的,可是里面有重新定义的变量,所以我就分开了,另外rsclose和connclose是在conn文件里定义好的关闭函数,主要的原因是case语句工作不正常,单个测试的时候是正确的,组合在一块时就提示以下错误:
========================
查询出租信息 类别 产权类型 户型 面积(m²) 楼层 区域 位置 租金 详细信息
[
Microsoft VBScript 编译器错误 错误 '800a03f6'

缺少 'End'

/iisHelp/common/500-100.asp,行242

ADODB.Recordset 错误 '800a0cc1'

在对应所需名称或序数的集合中,未找到项目。

/by/finished/Temp/cry.asp,行406


========================
本来选择出售查询时到173行“<% case "fy_cz" %>”就应该结束了,但是它却执行到了406行,这样在“求租”里的rs要输出的值在出售里是绝对找不到的,所以提示“在对应所需名称或序数的集合中,未找到项目”。case语句怎么会工作不正常呢,我查了if语句没有问题啊,还有哪个语句没有结束,DO while么,但下面有if i>=MaxPerPage then Exit Do啊!
之前我给每项加了一项分页代码,报错说变量重定义,然后我就把所需变量的定义全提了出来结果,case语句工作不正常,我晕。
是不是因为那个sub showContent的原因?但他里面只有一Do while语句啊,而且下面也结束了,哪的原因啊。我能确定是原因就是分页代码里面,因为我把他们去掉分页后就工作正常了,但一查几百条的数据不分页怎么行,谁能帮帮我,我在等
NetBoy 2003-12-28
  • 打赏
  • 举报
回复
<% case "fy_qz" %>
<% Response.Write("查询求租信息") %>
<% rs.Open "select * from "&cxlb&"",conn,1,1 %>
<%
if err.number<>0 then
response.write "数据库中无数据"
end if

if rs.eof And rs.bof then
Response.Write "<p align='center'><font size=2 color=red>对不起,没有查讯到您需要的信息!</font></p>"
else
totalPut=rs.recordcount

if currentpage<1 then
currentpage=1
end if

if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if

if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"cry.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
'dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"cry.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"cry.asp"
end if
end if
end if

sub showContent
'dim i
i=0
%>
<table width="80%" align="center">
<tr bgcolor="#fff8d9">
<td> <div align="center"><font size="2">类别</font></div></td>
<td> <div align="center"><font size="2">产权类型</font></div></td>
<td><font size="2">户型</font></td>
<td> <div align="center"><font size="2">面积(m²)</font></div></td>
<td> <div align="center"><font size="2">楼层</font></div></td>
<td><div align="center"><font size="2">区域</font></div></td>
<td> <div align="center"><font size="2">位置</font></div></td>
<td> <div align="center"><font size="2">租金</font></div></td>
<td width="23%"> <div align="center"><font size="2">详细信息</font></div></td>
</tr>
<%do while not rs.eof%>
<tr bgcolor="#fff8d9">
<td><div align="center"><font size="2">[<%= rs("fy_qz_id") %>]</font></div></td>
<td><font size="2"><%= rs("fy_qz_cqlx") %></font></td>
<td><font size="2"><%= rs("fy_qz_yqhx1") %></font></td>
<td><div align="center"><font size="2"><%= rs("fy_qz_jzmj_max") %></font></div></td>
<td><div align="center"></div></td>
<td><div align="center"><font size="2"><%= rs("fy_qz_yqqy") %></font></div></td>
<td> </td>
<td><font size="2"><%= rs("fy_qz_qwzj_max") %></font></td>
<td><div align="center"><font size="2">[<a href="nb_ShowMore.asp?fylx=cs&fy_id=<%=rs("fy_qz_id")%>" target="_blank">详细信息</a>]</font></div></td>
</tr>
<%
i=i+1
if i>=MaxPerPage then Exit Do
%>
<%
rs.movenext
loop
%>
</table>
<% End sub %>
<%
rsclose
connclose
%>
<% End select %>
</body>
</html>
NetBoy 2003-12-28
  • 打赏
  • 举报
回复
真受不了,代码有点长,没发完。
防灌水却影响了正常发贴,555
以下是query内接下来的代码
<% case "fy_qg" %>
<% Response.Write("查询求购信息") %>
<% rs.Open "select * from "&cxlb&"",conn,1,1 %>
<%
if err.number<>0 then
response.write "数据库中无数据"
end if

if rs.eof And rs.bof then
Response.Write "<p align='center'><font size=2 color=red>对不起,没有查讯到您需要的信息!</font></p>"
else
totalPut=rs.recordcount

if currentpage<1 then
currentpage=1
end if

if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if

if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"cry.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
'dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"cry.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"cry.asp"
end if
end if
end if

sub showContent
'dim i
i=0
%>
<table width="80%" align="center">
<tr bgcolor="#fff8d9">
<td> <div align="center"><font size="2">类别</font></div></td>
<td> <div align="center"><font size="2">户型</font></div></td>
<td><font size="2">房屋性质</font></td>
<td> <div align="center"><font size="2">面积(m²)</font></div></td>
<td> <div align="center"><font size="2">楼层</font></div></td>
<td><div align="center"><font size="2">区域</font></div></td>
<td> <div align="center"><font size="2">位置</font></div></td>
<td> <div align="center"><font size="2">接受价格</font></div></td>
<td width="23%"> <div align="center"><font size="2">详细信息</font></div></td>
</tr>
<%do while not rs.eof%>
<tr bgcolor="#fff8d9">
<td><div align="center"><font size="2">[<%= rs("fy_qg_id") %>]</font></div></td>
<td><font size="2"><%= rs("fy_qg_yqhx1") %></font></td>
<td><font size="2"><%= rs("fy_qg_yqfx") %></font></td>
<td><div align="center"><font size="2"><%= rs("fy_qg_yqlc_max") %></font></div></td>
<td> </td>
<td><div align="center"><font size="2"><%= rs("fy_qg_yqqy") %></font></div></td>
<td> </td>
<td><font size="2"><%= rs("fy_qg_jsjg_max") %></font></td>
<td><div align="center"><font size="2">[<a href="nb_ShowMore.asp?fylx=cs&fy_id=<%=rs("fy_cz_id")%>" target="_blank">详细信息</a>]</font></div></td>
</tr>
<%
i=i+1
if i>=MaxPerPage then Exit Do
%>
<%
rs.movenext
loop
%>
</table>
<% End sub %>
<%
rsclose
connclose
%>
ib915 2003-12-27
  • 打赏
  • 举报
回复
<% rs.Open "select * from "&cxlb&"",conn,1,1 %> ????
将分页代码与查询页面的代码合在一页不好吗?
我可看到眼花了^-^
ib915 2003-12-27
  • 打赏
  • 举报
回复
你的页面结构是怎样的?
显示错误是什么?
语法有错
<%
rsclose
connclose
%>
ib915 2003-12-27
  • 打赏
  • 举报
回复
up
服务器坏了,测试不了。我重装看看
NetBoy 2003-12-27
  • 打赏
  • 举报
回复
<% case "fy_cz" %>
<% Response.Write("查询出租信息") %>
<% rs.Open "select * from "&cxlb&"",conn,1,1 %>
<%
if err.number<>0 then
response.write "数据库中无数据"
end if

if rs.eof And rs.bof then
Response.Write "<p align='center'><font size=2 color=red>对不起,没有查讯到您需要的信息!</font></p>"
else
totalPut=rs.recordcount

if currentpage<1 then
currentpage=1
end if

if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if

if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"cry.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
'dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"cry.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"cry.asp"
end if
end if
end if

sub showContent
'dim i
i=0
%>
<table width="80%" align="center">
<tr bgcolor="#fff8d9">
<td> <div align="center"><font size="2">类别</font></div></td>
<td> <div align="center"><font size="2">户型</font></div></td>
<td><font size="2">房屋性质</font></td>
<td> <div align="center"><font size="2">面积(m²)</font></div></td>
<td> <div align="center"><font size="2">楼层</font></div></td>
<td><div align="center"><font size="2">区域</font></div></td>
<td> <div align="center"><font size="2">位置</font></div></td>
<td> <div align="center"><font size="2">租金</font></div></td>
<td width="23%"> <div align="center"><font size="2">详细信息</font></div></td>
</tr>
<%do while not rs.eof%>
<tr bgcolor="#fff8d9">
<td><div align="center"><font size="2">[<%= rs("fy_cz_id") %>]</font></div></td>
<td><font size="2"><%= rs("fy_cz_cqlx") %></font></td>
<td><font size="2"><%= rs("fy_cz_fwjg") %></font></td>
<td><div align="center"><font size="2"><%= rs("fy_cz_jzmj") %></font></div></td>
<td><div align="center"><font size="2"><% If rs("fy_cz_szlc")<>"" Then Response.Write(rs("fy_cz_szlc")&"/"&rs("fy_cz_zcs")) else Response.Write(rs("fy_cz_zcs")) End If %></font></div></td>
<td><div align="center"><font size="2"><%= rs("fy_cz_szqy") %></font></div></td>
<td> </td>
<td><font size="2"><%= rs("fy_cz_zj") %></font></td>
<td><div align="center"><font size="2">[<a href="nb_ShowMore.asp?fylx=cs&fy_id=<%=rs("fy_cz_id")%>" target="_blank">详细信息</a>]</font></div></td>
</tr>
<%
i=i+1
if i>=MaxPerPage then Exit Do
%>
<%
rs.movenext
loop
%>
</table>
<% End sub %>
<%
rsclose
connclose
%>
NetBoy 2003-12-27
  • 打赏
  • 举报
回复
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>query</title>
</head>

<body>
<%
select case cxlb

case "fy_cs" '查询出售信息
Response.Write("查询出售信息")
%>
<% rs.Open "select * from "&cxlb&"",conn,1,1 %>
<%
if err.number<>0 then
response.write "数据库中无数据"
end if

if rs.eof And rs.bof then
Response.Write "<p align='center'><font size=2 color=red>对不起,没有查讯到您需要的信息!</font></p>"
else
totalPut=rs.recordcount

if currentpage<1 then
currentpage=1
end if

if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if

if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"cry.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
'dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"cry.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"cry.asp"
end if
end if
end if

sub showContent
'dim i
i=0
%>
<table width="80%" align="center">
<tr bgcolor="#fff8d9">
<td> <div align="center"><font size="2">类别</font></div></td>
<td> <div align="center"><font size="2">户型</font></div></td>
<td><font size="2">房屋性质</font></td>
<td> <div align="center"><font size="2">面积(m²)</font></div></td>
<td> <div align="center"><font size="2">楼层</font></div></td>
<td><div align="center"><font size="2">区域</font></div></td>
<td> <div align="center"><font size="2">位置</font></div></td>
<td> <div align="center"><font size="2">价格</font></div></td>
<td width="23%"> <div align="center"><font size="2">详细信息</font></div></td>
</tr>
<%do while not rs.eof%>
<tr bgcolor="#fff8d9">
<td><div align="center"><font size="2">[<%= rs("fy_cs_id") %>]</font></div></td>
<td><font size="2"><%= rs("fy_cs_cqlx") %></font></td>
<td><font size="2"><%= rs("fy_cs_fwjg") %></font></td>
<td><div align="center"><font size="2"><%= rs("fy_cs_jzmj") %></font></div></td>
<td><div align="center"><font size="2"><% If rs("fy_cs_szlc")<>"" Then Response.Write(rs("fy_cs_szlc")&"/"&rs("fy_cs_zcs")) else Response.Write(rs("fy_cs_zcs")) End If %></font></div></td>
<td><div align="center"><font size="2"><%= rs("fy_cs_szqy") %></font></div></td>
<td> </td>
<td><font size="2"><%= rs("fy_cs_csjg") %></font></td>
<td><div align="center"><font size="2">[<a href="nb_ShowMore.asp?fylx=cs&fy_id=<%=rs("fy_cs_id")%>" target="_blank">详细信息</a>]</font></div></td>
</tr>
<%
i=i+1
if i>=MaxPerPage then Exit Do
%>
<%
rs.movenext
loop
%>
</table>
<% End sub %>
<%
rsclose
connclose
%>
NetBoy 2003-12-27
  • 打赏
  • 举报
回复
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp" -->
<%
Dim cxlb,fwjg,szqy,dlwz,mj_min,mj_max,jg_min,jg_max
cxlb=Request.form("cxlb")
fwjg=Request.form("fwjg")
szqy=Request.form("szqy")
dlwz=Request.form("dlwz")
mj_min=Request.form("mj_min")
mj_max=Request.form("mj_max")
jg_min=Request.form("jg_min")
jg_max=Request.form("jg_max")

If cxlb="" then cxlb=request.QueryString("cxlb") End If
If fwjg="" then fwjg=request.QueryString("fwjg") End If
If szqy="" then szqy=request.QueryString("szqy") End If
If dlwz="" then dlwz=request.QueryString("dlwz") End If
If mj_min="" then mj_min=request.QueryString("mj_min") End If
If mj_max="" then mj_max=request.QueryString("mj_max") End If
If jg_min="" then jg_min=request.QueryString("jg_min") End If
If jg_max="" then jg_max=request.QueryString("jg_max") End If
%>
<%
If cxlb="" Then
Response.redirect "../index/nb_query.asp" '上传时改成index.asp
End If
%>
<%
Function showpage(totalnumber,maxperpage,filename)
Dim n

If totalnumber Mod maxperpage=0 Then
n= totalnumber \ maxperpage
Else
n= totalnumber \ maxperpage+1
End If
'cxlb,fwjg,szqy,dlwz,mj_min,mj_max,jg_min,jg_max
Response.Write "<form method=Post action="&filename&"?cxlb="&cxlb&"&fwjg="&fwjg&"&szqy="&szqy&"&dlwz"&dlwz&"&mj_min="&mj_min&"&mj_max="&mj_max&"&jg_min="&jg_min&"&jg_max="&jg_max&">"
Response.Write "<p align='center'> "
If CurrentPage<2 Then
Response.Write "<font size=2>首页 上一页</font> "
Else
Response.Write "<a href="&filename&"?page=1&cxlb="&cxlb&"&fwjg="&fwjg&"&szqy="&szqy&"&dlwz"&dlwz&"&mj_min="&mj_min&"&mj_max="&mj_max&"&jg_min="&jg_min&"&jg_max="&jg_max&"><font size=2>首页</font></a> "
Response.Write "<a href="&filename&"?page="¤tPage-1&"&cxlb="&cxlb&"&fwjg="&fwjg&"&szqy="&szqy&"&dlwz"&dlwz&"&mj_min="&mj_min&"&mj_max="&mj_max&"&jg_min="&jg_min&"&jg_max="&jg_max&"><font size=2>上一页</font></a> "
End If

If n-currentpage<1 Then
Response.Write "<font size=2>下一页 尾页</font>"
Else
Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&cxlb="&cxlb&"&fwjg="&fwjg&"&szqy="&szqy&"&dlwz="&dlwz&"&mj_min="&mj_min&"&mj_max="&mj_max&"&jg_min="&jg_min&"&jg_max="&jg_max&">"
Response.Write "<font size=2>下一页</font></a> <a href="&filename&"?page="&n&"&cxlb="&cxlb&"&fwjg="&fwjg&"&szqy="&szqy&"&dlwz="&dlwz&"&mj_min="&mj_min&"&mj_max="&mj_max&"&jg_min="&jg_min&"&jg_max="&jg_max&"><font size=2>尾页</font></a>"
End If
Response.Write "<font size=2> 第</font><font size=2>"¤tPage&"页</font><font size=2>/共"&n&"页</font> "
Response.Write "<font size=2>共"&totalnumber&"条信息"
Response.Write "<font size=2> 转到:</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="¤tpage&">"
Response.Write " <input type='submit' value='GO' name='ssnh'></form>"
End Function
%>
<%
Const MaxPerPage=20
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(request("page")) then
currentPage=Cint(request("page"))
else
currentPage=1
end if
%>
<%
Dim rs,bookmark,i
Set rs= Server.CreateObject("Adodb.recordset")
%>

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧