📄 update.asp
字号:
<!--#INCLUDE FILE="odbc_connection.asp"-->
<html>
<head>
<title>更新成员</title>
</head>
<body>
<%
If Trim(Request("name"))="" Or Trim(Request("password"))=""Then
Response.Write "对不起,姓名、密码必须输入"
Response.Write "<p><a href='update_form.asp'>返回,重新修改</a>"
Else
Dim name,password,tel,email,home,intro,handtel,ftype,web
name=Request("name")
password=Request("password")
tel=Request("tel")
home=request("home")
email=request("email")
intro=request("intro")
handtel=request("handtel")
ftype=request("ftype")
web=request("web")
'On Error Resume Next
'先将原有数据清除,再插入新的数据,为了安全,使用事务处理
db.BeginTrans '开始事务处理
Dim strSql
strSql="Delete From users Where id =" & Session("id")
db.Execute(strSql)
'再将数据填入数据库中
Dim sValues
strSql = "Insert into users(name,password"
sValues = "values('" & name & "','" & password & "'"
If tel<>"" Then
strSql = strSql & ",tel"
sValues = sValues & ",'" & tel & "'"
End If
If handtel<>"" Then
strSql = strSql & ",handtel"
sValues = sValues & ",'" & handtel & "'"
End If
If ftype<>"" Then
strSql = strSql & ",ftype"
sValues = sValues & ",'" & ftype & "'"
End If
If home<>"" Then
strSql = strSql & ",home"
sValues = sValues & ",'" & home & "'"
End If
If email<>"" Then
strSql = strSql & ",email"
sValues = sValues & ",'" & email & "'"
End If
If web<>"" Then
strSql = strSql & ",web"
sValues = sValues & ",'" & web & "'"
End If
If intro<>"" Then
strSql = strSql & ",intro"
sValues = sValues & ",'" & intro & "'"
End If
strSql = strSql & ") " & sValues & ")"
response.write sql
db.Execute(strSql)
If db.Errors.Count>0 Then
db.RollbackTrans '如有错误,取消事务处理结果
Response.Write "保存过程中发生错误,必须重新修改"
Response.Write "<p><a href='change.asp'>返回,重新修改</a>"
Else
db.CommitTrans '如无错误,提交事务处理结果
Response.Write "<h2 align='center'>您的信息已经安全修改,请牢记密码</h2>"
response.write "<center><table width='70%'><tr><td>"
response.write "<p>姓名:" & name
response.write "<p>电话:" & tel
response.write "<p>手机:" & handtel
response.write "<p>email:" & email
response.write "<p>web:" & web
response.write "<p>住址:" & home
response.write "<p>简介:" & intro
response.write "<p>朋友类型:" & ftype
response.write "</td></tr></table>"
Response.Write "<p><a href='index.asp' >谢谢,请您返回首页</a></center>"
End If
End If
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -