📄 hotel_submit.asp
字号:
<!--#include file="../Include/AdoConn.asp"-->
<!--#include FILE="upload.inc"-->
<%
Num=35
dim sName(35)
'-----------------------------------------------------------------------------
'添加图片
dim upload,iCount
set upload=new upload_5xSoft ''建立上传对象
for i=0 to Num-1 '列出所有form数据
sName(i)=upload.form("textfield" & i)
next
code=upload.form("code")
iCount=26
for each formName in upload.objFile ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
sName(iCount)=file.filename
file.SaveAs Server.mappath("\china\hotel\hotelimages\" & sName(iCount)) ''保存文件
end if
iCount=iCount+1
set file=nothing
next
set upload=nothing ''删除此对象
'-----------------------------------------------------------------------------
%>
<%
set rst=server.CreateObject ("adodb.recordset")
strsql="select top 1 * from xt_td_hotel"
rst.Open strsql,conn
N=Num
if code<>"" then'修改
for i=1 to 32
if i=5 or i=23 or i=24 then
if isDate(sName(i-1)) then
strSet=strSet&rst(i).name&"=#"& sName(i-1) & "#"
else
strSet=strSet&rst(i).name&"=#1900-01-01#"
end if
else
strSet=strSet&rst(i).name&"="&"'"& sName(i-1) &"'"
end if
strSet=strSet+","
next
for i=33 to 35
if trim(sName(i-1))="" then
strSet=strSet&rst(i).name & "=0"
else
strSet=strSet&rst(i).name&"=" & sName(i-1)
end if
if i<35 then strSet=strSet+","
next
strsql="update xt_td_hotel set "&strSet&" where 酒店编码='"& code & "'"
conn.execute (strsql)
info="您已提交修改成功!"
else'新增
'''''''''''''''''''''检查数据库内是否有此酒店"判断中文名"
set rst2=server.CreateObject ("ADODB.recordset")
StrSQL="select 酒店名_cn from xt_td_hotel where 酒店名_cn='" & sName(0) & "'"
strsql=strsql & " and 所在市='" & sName(2) & "'"
rst2.Open strsql,conn,3,2
if not rst2.EOF then
%>
<script Language="JavaScript">
<!--
alert("此酒店已注册!");
history.back(-1);
// -->
</script>
<%
Response.End
end if
strsql=" Select Max(clng(酒店编码)) From xt_td_hotel"
set rst2=conn.execute(strsql)
if rst2.eof then
sNumber="1"
else
sNumber=clng(rst2(0))+1
end if
rst2.Close
set rst2=nothing
'''''''''''''''''''''检查结束
dim strTitle,strValue'记录自动生成form\rst.fields语句的变量
strTitle=""
strValue=""
for i=0 to 35
strTitle=strTitle&rst(i).name
if i=0 then
strValue=strValue & "'" & sNumber & "'"
elseif i=5 or i=23 or i=24 then
if isDate(sName(i-1)) then
strValue=strValue & "#" & sName(i-1) & "#"
else
strValue=strValue & "#1900-01-01#"
end if
elseif i=33 or i=34 or i=35 then
if isNumeric(sName(i-1)) then
strValue=strValue & sName(i-1)
else
strValue=strValue & "0"
end if
else
strValue=strValue&"'"& sName(i-1)&"'"
end if
if i<>35 then
strTitle=strTitle+","
strValue=strValue+","
end if
next
strsql2="insert into xt_td_hotel ("&strTitle&")values("&strValue&")"
conn.execute (strsql2)
'取得编码,传入下一页房型注册页
'Response.Redirect "room_edit.asp?hotelName="& sName(1)
info="您已提交成功!"
end if
rst.Close
set rst=nothing
response.redirect("hotel_edit.asp")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<%= code%>
<%for i=0 to 18%>
<%= sName(i)%><br>
<%next%>
<br>
<%=info%>
<br>
<%=strsql%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -