save.asp

来自「办公系统」· ASP 代码 · 共 82 行

ASP
82
字号
<!--#include file="../includes/db.asp"-->
<%
call insureID()
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>办公自动化系统</title>
</head>

<body>
<%
if (request("action")="Add") then
	call saveAdd()
	response.end
elseif (request("action")="Edit") then
	call saveEdit()
	response.end
elseif (request("action")="Delete") then
	call saveDelete()
	response.end
else
	call trigErr()
end if

sub saveAdd()
	dim Note_title
	dim Note_content
	Note_title = request("Title")
	Note_content = request("Content")
	Note_title = replacePrime(Note_title)
	Note_content = replacePrime(Note_content)
	if Note_title="" or Note_content="" then
		call trigErr()
	end if
	User_id = session("User_id")	
	sql="INSERT INTO Notes (Note_title,Note_content,Note_date,User_id) " _
		&"VALUES ('"&Note_title&"', '"&Note_content&"', GETDATE(), "&User_id&") "
	call openDB()
	conn.execute(sql)
	response.write "提交成功!&nbsp;&nbsp;&lt;&lt;<a href=""Browse.asp"">返回</a>"
	call closeDB()
end sub

sub saveEdit()
	dim Note_id
	dim Note_title
	dim Note_content
	Note_id = request("Note_id")
	if Note_id = "" then
		call trigErr()
	end if
	Note_title = request("Title")
	Note_content = request("Content")
	Note_title = replacePrime(Note_title)
	Note_content = replacePrime(Note_content)
	if Note_title="" or Note_content="" then
		call trigErr()
	end if
	sql="UPDATE Notes " _
		&"SET Note_title='"&Note_title&"',Note_content='"&Note_content&"',Note_date=GETDATE() " _
		&"WHERE Note_id="&Note_id
	call openDB()
	conn.execute(sql)
	response.write "修改成功!&nbsp;&nbsp;&lt;&lt;<a href=""Browse.asp"">返回</a>"
	call closeDB()
end sub

sub saveDelete()
	Note_id = request("Note_id")
	if Note_id = "" then
		call trigErr()
	end if
	sql ="DELETE FROM Notes WHERE Note_id="&Note_id
	call openDB()
	conn.execute(sql)
	response.write "删除成功!&nbsp;&nbsp;&lt;&lt;<a href=""Browse.asp"">返回</a>"
	call closeDB()
end sub
%>
</body>
</html>

⌨️ 快捷键说明

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