📄 cityview_submit.asp
字号:
<!--#include file="../Include/AdoConn.asp"-->
<!--#include FILE="upload.inc"-->
<%
dim sName(6)
'-----------------------------------------------------------------------------
'添加图片
dim upload,iCount
set upload=new upload_5xSoft ''建立上传对象
for i=0 to 6 '列出所有form数据
sName(i)=upload.form("textfield" & i)
next
code=upload.form("code")
code1=upload.form("code1")
for each formName in upload.objFile ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
sName(5)=file.filename
file.SaveAs Server.mappath("\china\city\cityviewimages\" & sName(5)) ''保存文件
end if
set file=nothing
next
set upload=nothing ''删除此对象
'-----------------------------------------------------------------------------
%>
<%
set rst=server.CreateObject ("adodb.recordset")
strsql="select top 1 * from xt_td_CityView"
rst.Open strsql,conn
if code<>"" and code1<>"" then'修改
for i=0 to 6
strSet=strSet&rst(i).name&"="&"'"& sName(i) &"'"
if i<>6 then
strSet=strSet+","
end if
next
strsql="update xt_td_CityView set "&strSet&" where 城市编码=" & code
strsql=strsql & " and 风景名称_cn='" & code1 & "'"
conn.execute (strsql)
info="您已提交修改成功!"
else'新增
'''''''''''''''''''''检查数据库内是否有此城市"判断中文名"
set rst2=server.CreateObject ("ADODB.recordset")
StrSQL="select 城市编码 from xt_td_CityView where 城市编码="& sName(0)
strsql=strsql & " and 风景名称_cn='" & sName(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=0 to 6
strTitle=strTitle&rst(i).name
strValue=strValue&"'"& sName(i) &"'"
if i<>6 then
strTitle=strTitle+","
strValue=strValue+","
end if
next
strsql="insert into xt_td_CityView ("&strTitle&")values("&strValue&")"
conn.execute (strsql)
info="您已提交成功!"
end if
rst.Close
set rst=nothing
response.redirect("cityView_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>
<p>
<%= code%>
<br>
<%= code1%>
<%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 + -