<%
set rs=server.CreateObject("adodb.recordset")
rssql="select * from lei_fangxing a,(select id from lei_fangxing_class where id>3) as b where a.roomtype=b.id"
'rssql="select * from lei_hotel a,(select id from lei_fangxing where id>5) as b whree a.fangxingid=b.id"
rs.open rssql,conn,1,1
if not rs.bof and not rs.eof then
do while not rs.eof
Response.Write(rs("roomhotel")&"<br>")
rs.movenext
loop
end if
%><br />
<%
set rs=server.CreateObject("adodb.recordset")
rssql="select * from lei_fangxing where roomtype in(select id from lei_fangxing_class where id>3)"
'rssql="select * from lei_hotel a,(select id from lei_fangxing where id>5) as b whree a.fangxingid=b.id"
rs.open rssql,conn,1,1
if not rs.bof and not rs.eof then
do while not rs.eof
Response.Write(rs("roomhotel")&"<br>")
rs.movenext
loop
else
Response.Write("没有找到数据")
end if
%><br />
<%
set rs=server.CreateObject("adodb.recordset")
rssql="select * from lei_hotel where id in(select a.roomhotel from lei_fangxing a,(select id from lei_fangxing_class where id>3) as b where a.roomtype=b.id)"
'rssql="select * from lei_hotel a,(select id from lei_fangxing where id>5) as b whree a.fangxingid=b.id"
rs.open rssql,conn,1,1
if not rs.bof and not rs.eof then
do while not rs.eof
Response.Write(rs("id")&"--"&rs("hotel")&"<br>")
rs.movenext
loop
end if
%>
本文档展示了使用 ASP.NET 和 ADO 对象进行数据库查询的示例代码,包括从不同表中根据条件获取记录的方法。通过连接多个表并设置查询条件,可以有效地筛选和展示所需的数据。
1588

被折叠的 条评论
为什么被折叠?



