matrix3_bbs_update.asp

来自「这是ASP的OA」· ASP 代码 · 共 63 行

ASP
63
字号
<!-- #include file="const.asp" -->
<%
call opendb()
checkadmin()
dim action1
action1=request.QueryString("action1")
if action1="update" then
	call doupdate()
else
	call list()
end if
sub doupdate()
	dim name,tm,sql,id
	name=trim(request.form("name"))
	tm=trim(request.form("time"))
	id=nrequest2("id")
	if id<>"" then
		id=replace(id,",","")
		if name<>"" then
			name=replace(name,",","")
			if tm<>"" then
				tm=replace(tm,",","")
				sql="update m3_bbs set name='"&name&"',addtime='"&tm&"',lasttime='"&tm&"' where id="&id&""
			else
				sql="update m3_bbs set name='"&name&"' where id="&id&""
			end if
			conn.execute(sql)
			call msg2("更新成功!")
		else
			if tm<>"" then
				tm=replace(tm,",","")
				sql="update m3_bbs set addtime='"&tm&"',lasttime='"&tm&"' where id="&id&""
				conn.execute(sql)
				call msg2("更新成功!")
			end if
		end if
	else
		call msg2("缺少参数!")
	end if
end sub
sub list()
%>
<form name="form1" method="post" action="?action1=update">
  <p>帖 子 ID: 
    <input name="id" type="text" id="id" size="15" maxlength="15">
  </p>
  <p>发 帖 人: 
    <input name="name" type="text" id="name" size="15" maxlength="20">
  </p>
  <p>发帖时间: 
    <input name="time" type="text" id="time" value="<%=now%>" size="20" maxlength="30">
  </p>
  <p>
    <input type="submit" name="Submit" value=" 更 改 ">
  </p>
  </form>
<%end sub
sub msg2(str)
	call closedb()
	response.write"<br><br><center>"&str&"<br><br><br><a href=""matrix3_bbs_update.asp"">返 回</a></center>"
	response.End()
end sub
%>

⌨️ 快捷键说明

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