⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hotel_edit1.asp

📁 ASP程序实现的酒店预定系统
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!--#include file="../Include/AdoConn.asp"-->
<%
	dim tableName	'下面函数的入口参数,表名
	dim KeyWord	'各表主关键字名称
	dim KeyType	'主键类型,自动增加型为"空",字符型为 " ' "
	dim Num		'保存取得的各字段个数
	tableName="xt_td_hotel"
	KeyWord="酒店编码"
	KeyType=""
	Num=32
	
redim var(Num)
for i=0 to Num
	var(i)=""
next
	
code=request.querystring("code")'修改
if code<>"" then 
set rst=server.createobject("adodb.recordset")
strsql="select * from "&tableName&" where "&KeyWord&"="&KeyType&code&KeyType
N=Num
rst.open strsql,conn
	if not rst.eof then 
		for i=0 to N
			var(i)=rst(i)
		next
	end if
	rst.Close
	set rst=nothing
end if
if Request.QueryString ("submit")="submit" then'是否是提交状态
	set rst=server.CreateObject ("adodb.recordset")
	strsql="select top 1 * from "&tableName
	rst.Open strsql,conn
	N=Num
	code=Request.Form ("code")
	if code<>"" then'修改
	for i=1 to N
		strSet=strSet&rst(i).name&"="&"'"&Request.Form(i)&"'"
		if i<>N then 
		strSet=strSet+","
		end if
	next
	strsql="update "&tableName&" set "&strSet&" where "&KeyWord&"="&KeyType&code&KeyType
	conn.execute (strsql)
	info="您已提交修改成功!"

	else'新增
	
'''''''''''''''''''''检查数据库内是否有此酒店"判断中文名"
set rst2=server.CreateObject ("ADODB.recordset")
StrSQL="select 酒店名_cn from "&tableName&" where 酒店名_cn='"&Request.Form (1)&"'"
rst2.Open strsql,conn,3,2
if not rst2.EOF then
%>
<script Language="JavaScript">
<!--
alert("此酒店已注册!");
history.back(-1);
// -->
</script>

<%
Response.End 
end if
	rst2.Close
	set rst2=nothing
'''''''''''''''''''''检查结束


	dim strTitle,strValue'记录自动生成form\rst.fields语句的变量
	strTitle=""
	strValue=""
	for i=1 to N
		strTitle=strTitle&rst(i).name
		strValue=strValue&"'"&Request.Form(i)&"'"
		if i<>N then 
		strTitle=strTitle+","
		strValue=strValue+","
		end if
	next
	strsql="insert into "&tableName&"("&strTitle&")values("&strValue&")"
	conn.execute (strsql)
	'取得编码,传入下一页房型注册页
	Response.Redirect "room_edit.asp?hotelName="&Request.Form(1)
	'info="您已提交成功!"
	end if
	rst.Close
	set rst=nothing
end if
'<input type="hidden" name="code" value="<%=var(0)>此隐藏域用于提交主键,将其入到所有输入变量之后。
%>
<%
'取出地区
set rst1=server.CreateObject ("adodb.recordset")
strsql="select  * from xt_td_city "
rst1.open strsql,conn,3,2
%>
<html>
<head>
<title>注册酒店</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="/Css/All.css">
<script language="javascript">
ArrayString=new Array(0,"textfield","中文 酒店名称不能为空!");
</script>
<script language="javascript" src="../js/checkForm.js"></script>
<script language="javascript" src="../js/Check_email_num.js"></script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"><%=info%></td>
  </tr>
</table>
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center" background="../Images/title_edit.gif">
  <tr > 
    <td width="199" height="30">&nbsp;</td>
    <td width="112" height="30" align="center">注 册 酒 店</td>
    <td width="189" height="30">&nbsp;</td>
  </tr>
</table>
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center" class="snd">
  <form name="form1" method="post" enctype="multipart/form-data" action="hotel_edit.asp?submit=submit" onsubmit="return CheckForm(this)">
  <tr> 
    <td width="24" align="right" height="20">&nbsp;</td>
    <td width="55" align="right" height="20">&nbsp;</td>
    <td width="28" height="20" align="center">&nbsp;</td>
      <td width="240" height="20">&nbsp;</td>
      <td width="129" height="20">&nbsp;</td>
    <td width="24" height="20">&nbsp;</td>
  </tr>
  <tr> 
    <td width="24" align="right" height="20">&nbsp;</td>
    <td width="55" align="right" height="20">酒店名称</td>
    <td width="28" height="20" align="center">(中)</td>
      <td width="240" height="20"> 
        <input type="text" name="textfield" size="20" maxlength="20" value="<%=var(1)%>">
      ** </td>
      <td width="129" height="20">(**为必填项,下同)</td>
    <td width="24" height="20">&nbsp;</td>
  </tr>
  <tr> 
    <td width="24" align="right" height="20">&nbsp;</td>
    <td width="55" align="right" height="20">&nbsp;</td>
    <td width="28" height="20" align="center">(韩)</td>
      <td width="240" height="20"> 
        <input type="text" name="textfield2" size="20" maxlength="20" value="<%=var(2)%>">
    </td>
      <td width="129" height="20">&nbsp;</td>
    <td width="24" height="20">&nbsp;</td>
  </tr>
  <tr> 
    <td width="24" align="right" height="20">&nbsp;</td>
    <td width="55" align="right" height="20">所在市 </td>
    <td width="28" height="20" align="center">&nbsp;</td>
      <td width="240" height="20"> 
        <select name="select">
        <%if rst1.RecordCount<>0 then 
			for i=1 to rst1.RecordCount 
		%>
        <option value="<%=rst1("城市编码")%>"<%if var(3)=rst1("城市编码") then response.write "selected" end if%>><%=rst1("中文城市名")%></option>
        <%rst1.MoveNext 
	        next	
		end if
		rst1.close
		 %>
      </select>
      ** </td>
      <td width="129" height="20">&nbsp;</td>
    <td width="24" height="20">&nbsp;</td>
  </tr>
  <tr> 
    <td width="24" align="right" height="20">&nbsp;</td>
    <td width="55" align="right" height="20">星级</td>
    <td width="28" height="20" align="center">&nbsp;</td>
      <td width="240" height="20"> 
        <select name=jb_star>
        <option value="0" <%if var(4)="0" then response.write "selected" end if%>>其他</option>
        <option value="5" <%if var(4)="5" then response.write "selected" end if%>>5星级</option>
        <option value="4" <%if var(4)="4" then response.write "selected" end if%>>4星级</option>
        <option value="3" <%if var(4)="3" then response.write "selected" end if%><%if var(4)="" then response.write "selected" end if%>>3星级</option>
        <option value="2" <%if var(4)="2" then response.write "selected" end if%>>2星级</option>
        <option value="1" <%if var(4)="1" then response.write "selected" end if%>>1星级</option>
      </select>
    </td>
      <td width="129" height="20">&nbsp;</td>
    <td width="24" height="20">&nbsp;</td>
  </tr>
  <tr> 
    <td width="24" align="right" height="20">&nbsp;</td>
    <td width="55" align="right" height="20">开业日期</td>
    <td width="28" height="20" align="center">&nbsp;</td>
      <td width="240" height="20"> 
        <input type="text" name="textfield4" size="20" maxlength="10" value="<%if var(5)="" then response.write date else response.write var(5)%>">
        <img src="../Images/calendar.gif" width="34" height="21"> </td>
      <td width="129" height="20">日期格式:<%=date%></td>
    <td width="24" height="20">&nbsp;</td>
  </tr>
  <tr> 
    <td width="24" align="right" height="20">&nbsp;</td>
    <td width="55" align="right" height="20">信用卡</td>
    <td width="28" height="20" align="center">(中)</td>
      <td width="240" height="20"> 
        <input type="text" name="textfield5" size="25" maxlength="25" value="<%=var(6)%>">
    </td>
      <td width="129" height="20">最多可输入25个字。</td>
    <td width="24" height="20">&nbsp;</td>
  </tr>
  <tr> 
    <td width="24" align="right" height="20">&nbsp;</td>
    <td width="55" align="right" height="20">&nbsp;</td>
    <td width="28" height="20" align="center">(韩)</td>
      <td width="240" height="20"> 
        <input type="text" name="textfield6" size="25" value="<%=var(7)%>" maxlength="25">
    </td>
      <td width="129" height="20">最多可输入25个字。</td>
    <td width="24" height="20">&nbsp;</td>
  </tr>
  <tr> 
    <td width="24" align="right" height="20">&nbsp;</td>
    <td width="55" align="right" height="20">餐饮设施</td>
    <td width="28" height="20" align="center">(中)</td>
      <td width="240" height="20"> 
        <textarea name="textarea7" cols="30" rows="5" onBlur="return strLen(this)"><%=var(8)%></textarea>
    </td>
      <td width="129" height="20">最多可输入100个字。</td>
    <td width="24" height="20">&nbsp;</td>
  </tr>
  <tr> 
    <td width="24" align="right" height="20">&nbsp;</td>
    <td width="55" align="right" height="20">&nbsp;</td>
    <td width="28" height="20" align="center">(韩)</td>
      <td width="240" height="20"> 
        <textarea name="textarea8" cols="30" rows="5" onBlur="return strLen(this)"><%=var(9)%></textarea>
    </td>
      <td width="129" height="20">最多可输入100个字。</td>
    <td width="24" height="20">&nbsp;</td>
  </tr>
  <tr> 
    <td width="24" align="right" height="20">&nbsp;</td>
    <td width="55" align="right" height="20">休间设施</td>
    <td width="28" height="20" align="center">(中)</td>
      <td width="240" height="20"> 
        <textarea name="textarea9" cols="30" rows="5" onBlur="return strLen(this)"><%=var(10)%></textarea>
    </td>
      <td width="129" height="20">最多可输入100个字。</td>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -