我做了二手房查询,做查询的时候遇到麻烦了!
sisiz 2003-10-23 09:10:49 我下面的代码只能查数据库里有的记录,如果数据库里满足条件的记录的话就出错!
<!--#include file="../conn.asp"-->
<%'
pageno=request.querystring("pageno")
pmcount=6
quyu=request("quyu")
ceng=request("ceng")
fw=request("fw")
huxing=request("huxing")
zs=request("zs")
img=request("img")
'查询新城区
if quyu="不限" then
sql="select * from minyong order by riqi desc"
elseif quyu<> "不限" and ceng="不限" and huxing="不限" and fw="不限" then
sql="select * from minyong where quyu='" & quyu &"'"
elseif quyu<>"不限" and ceng<>"不限" and huxing="不限" and fw="不限" then
sql="select * from minyong where quyu='" & quyu &"' and ceng='" & ceng &"'"
elseif quyu<>"不限" and fw<>"不限" and ceng="不限" then
sql="select * from minyong where quyu='" & quyu &"' and fw='" & fw &"'"
elseif quyu<>"不限" and fw<>"不限" and ceng<>"不限" and huxing="不限" then
sql="select * from minyong where quyu='" & quyu &"' and ceng='" & ceng &"' and fw='" & fw &"'"
else
response.Write("没有满足条件的记录!")
end if
rs.open sql,Conn,1,1
rs.pagesize=pmcount
mpage=rs.pagecount
if isempty(pageno) or cint(pageno)<1 or cint(pageno)>mpage then
pageno=1
end if
rs.absolutepage=pageno
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">td{font-size:12px}</style>
<title>无标题文档</title>
</head>
<body bgcolor="#EBD7FF">
<table width="100%" border="1" align="center" cellpadding="1" cellspacing="0" bordercolor="#0099FF">
<tr align="center" valign="middle">
<td height="40" colspan="8" bgcolor="#3399FF">您查询的是民用住宅二手房信息</td>
</tr>
<tr align="center" valign="middle">
<td width="14%" height="35"><font color="#9900CC">区域</font></td>
<td width="11%" height="35"><font color="#9900CCC">楼层</font></td>
<td width="11%" height="35"><font color="#9900CC">面积</font></td>
<td width="15%" height="35"><font color="#9900CC">户型</font></td>
<td width="17%" height="35"><font color="#9900CC">出租/出售</font></td>
<td width="8%" height="35"><font color="#9900CC">备注</font></td>
<td width="11%"><font color="#9900CC">日期</font></td>
<td width="13%"><font color="#9900CC">出租/出售情况</font></td>
</tr>
<%
rc=rs.pagesize
re=1
do while not rs.eof and rc>0
quyu=rs("quyu")
mj=rs("mj")
ceng=rs("ceng")
fw=rs("fw")
huxing=rs("huxing")
img=rs("img")
%>
<tr align="center" valign="middle">
<td height="15"><%=rs("quyu")%> </td>
<td height="15"><%=rs("ceng")%> </td>
<td height="15"><%=rs("mj")%> </td>
<td height="15">
<%if img<>"" then%>
<a href="<%=rs("../img")%>"><%=rs("huxing")%></a>
<%else%>
<%=rs("huxing")%><br> <font color="#990000">暂没有户型图 </font>
<%end if%>
</td>
<td height="15"><%=rs("zs")%> </td>
<td height="15"><%=rs("memo")%> </td>
<td height="15"><%=rs("riqi")%> </td>
<td height="15"><%=rs("biaozhi")%> </td>
</tr>
<%
rs.movenext
re=re+1
rc=rc-1
loop
%>
<tr align="right" valign="middle">
<td height="8" colspan="8">
<% for pno=1 to mpage
if pno=cint(pageno) then%>
<%=pno%>
<%else%>
<b><a href='../serach1.asp?pageno=<%=pno%>'><%=pno%></a></b>
<%end if%>
<%next%>
</td>
</tr>
</table>
</body>
</html>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>