?? admin_editchk.asp
字號:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="hotel.asp" -->
<!--#include file="include/is_admin.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>
<body>
<div align="center">
<table width="706" height="281" border="0" class="table_big">
<tr>
<td valign="top"><div align="center">
<!--#include file="include/admin_head.asp" -->
<%
dim err(4)
dim room_id,room_name,room_type,cost,haveerr,rs_edit,sql
'接收表單數據-------------
room_id=request.Form("room_id")
room_name=request.Form("name")
room_type=request.Form("type")
cost=request.Form("cost")
'檢查數據--------------------
if len(room_name) > 30 then err(1)="房間名稱不能超過30個字符"
if len(room_name) < 2 then err(1)="房間名稱不能少于2個字符"
if not IsNumeric(cost) then err(2)="費用必須是數字"
if room_type="" then err(3)="房間類型不能位為空"
if len(cost) >4 then err(4)="費用不能多于4位數"
for i=1 to 4
if err(i)<>"" then haveerr=1
next
'根據haveerr值進行不同操作顯示不同結果---------------------
If haveerr = 0 Then
'打開房間數據庫--------------------
set rs_edit=server.CreateObject("adodb.recordset")
sql = "select * from room where room_id=" & room_id
rs_edit.open sql,hotel_conn,3,2
rs_edit("name")=room_name
rs_edit("type")=room_type
rs_edit("cost")=cost
rs_edit.update
%>
<br>
<table width="421" border="0" class="table_small">
<tr>
<td> </td>
</tr>
<tr>
<td class="text_title"><div align="left">房間維護成功</div></td>
</tr>
<tr>
<td class="table_title"> </td>
</tr>
<tr>
<td class="text"><div align="left">ID為<%= room_id %>的房間維護后其屬性更改為</div></td>
</tr>
<tr>
<td class="text"><div align="left">名稱:<%= room_name %></div></td>
</tr>
<tr>
<td class="text"><div align="left">類型:<%= room_type %> 費用:<%= cost %></div></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<% Else %>
<br>
<table width="418" border="0" class="table_small">
<tr>
<td width="10"> </td>
</tr>
<tr>
<td class="text_title"><div align="left">發現以下錯誤:</div></td>
</tr>
<tr>
<td class="table_title"> </td>
</tr>
<tr>
<td class="text_error">
<div align="left">
<%
for i=1 to 4
if err(i) <> "" then response.Write("●" & err(i) & "<br>")
next
%>
</div></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<% End If %>
<br>
</div></td>
</tr>
</table>
</div>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -