?? search.asp
字號:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="hotel.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>房間查詢</title>
<style type="text/css">
<!--
@import url("style.css");
-->
</style>
</head>
<%
set_room=request.Form("set_room")
set_cost=request.Form("set_cost")
%>
<body>
<div align="center">
<table width="706" height="281" border="0" class="table_big">
<tr>
<td valign="top"><div align="center">
<!--#include file="include/head.asp" -->
<br>
<form name="form1" method="post" action="">
<table width="533" border="0" class="table_small">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" class="text_title"><div align="left">請給出查詢條件:</div></td>
</tr>
<tr>
<td colspan="2" class="table_title"> </td>
</tr>
<tr>
<td colspan="2" class="text"><div align="left">
<p>查看所有費用上限
<select name="set_cost" class="select_filed2" id="set_cost">
<option selected>不作要求</option>
<option>50元</option>
<option>200元</option>
<option>400元</option>
<option>600元</option>
<option>600元以上</option>
</select>
的
<select name="set_room" class="select_filed2" id="set_room">
<option selected>所有</option>
<option >總統套房</option>
<option>觀光二人間</option>
<option>標準間</option>
<option>普通二人間</option>
<option>單人間</option>
<option>普通四人間</option>
<option>其他</option>
</select>
房間</p>
</div></td>
</tr>
<tr>
<td width="341" class="text"> </td>
<td width="121" class="text"><div align="center">
<input name="search" type="submit" class="button_" id="search" value="查詢">
</div></td>
</tr>
</table>
</form>
<%
if set_room="" and set_cost="" then
response.End()
else
%>
<%
set rs_search=server.CreateObject("adodb.recordset")
sql = "select * from room "
'如果輸入查詢條件,構造where結構-----------
if not (set_cost = "不作要求" and set_room = "所有" )then
sql = sql & "where "
end if
if set_room <> "所有" then
sql = sql & "type = '" & set_room& "'"
end if
if set_cost <> "不作要求" and set_room <> "所有" then
sql = sql & " and "
end if
if set_cost = "50元" then
sql = sql & "cost <= 50"
elseif set_cost = "200元" then
sql = sql & "cost <= 200"
elseif set_cost = "400元" then
sql = sql & "cost <=400"
elseif set_cost = "600元" then
sql = sql & "cost <= 600"
elseif set_cost = "600元以上" then
sql = sql & "cost > 600"
end if
'調試時加入的語句用來查看生成的sql命令---------------
'response.Write(sql)
'打開房間數據庫---------------
rs_search.open sql,hotel_conn,3,2
if rs_search.eof or rs_search.bof then
searchok=0
else
searchok=1
end if
%>
<table width="533" border="0" class="table_small">
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td colspan="4" class="text_title"><div align="left">查詢結果:
<%
if searchok=1 then
response.Write("查看所有開放于"& set_time &"的"& set_room &"房間,費用上限"& set_cost)
end if
%>
</div></td>
</tr>
<tr>
<td colspan="4" class="table_title"> </td>
</tr>
<% If searchok=0 Then %>
<tr>
<td colspan="4" class="text_error"><div align="left">●沒有找到符合要求的房間</div></td>
</tr>
<% Else %>
<tr class="text_title">
<td width="145"><div align="left">房間名稱</div></td>
<td width="112"><div align="left">房間類型</a></div></td>
<td width="136"><div align="left">費用(元/小時)</div></td>
<td width="118"><div align="left">使用時間</div></td>
</tr>
<%
rs_search.movefirst
while (not rs_search.eof)
%>
<tr class="text">
<% urltext="preengage.asp?room_id="& rs_search("room_id") %>
<td><div align="left"><a href="<%= urltext %>"><%= rs_search("name") %></a></div></td>
<td><div align="left"><%= rs_search("type") %></div></td>
<td><div align="left"><%= rs_search("cost") %></div></td>
<td><div align="left">24小時</div></td>
</tr>
<%
rs_search.movenext
Wend
%>
<tr>
<td colspan="4" class="text"> </td>
</tr>
<tr>
<td colspan="4" class="text"><div align="left">●點擊房間名稱可以直接預約該房間<br>
</div></td>
</tr>
<% End If %>
<tr>
<td colspan="4"> </td>
</tr>
</table>
<br>
<!--#include file="include/foot.asp" -->
<br>
</div></td>
</tr>
</table>
</div>
<% End If %>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -