📄 savestaff.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<%
dim id,realname,sn,business,branch,mail,tel,duty,RegTime,lastlogintime,content,SortNum
id=request.Form("id")
realname=checkStr(request.Form("realname"))
sn=checkStr(request.Form("sn"))
business=checkStr(request.Form("business"))
branch=checkStr(request.Form("branch"))
mail=checkStr(request.Form("mail"))
tel=checkStr(request.Form("tel"))
duty=checkStr(request.Form("duty"))
content=checkStr(request.Form("content"))
SortNum=checkStr(request.Form("SortNum"))
if realname="" then
response.Write("<script>alert('真实姓名不能为空!');history.back()</script>")
response.End()
end if
if not isnumeric(sn) then
response.Write("<script>alert('员工编号须为数字!');history.back()</script>")
response.End()
end if
if business="" then
response.Write("<script>alert('职务不能为空!');history.back()</script>")
response.End()
end if
if branch="" then
response.Write("<script>alert('部门不能为空!');history.back()</script>")
response.End()
end if
dim check
if id<>"" then
set check=conn.execute("select realname from staff where realname='"&realname&"' and id<>"&id&"")
else
set check=conn.execute("select realname from staff where realname='"&realname&"'")
end if
if not check.eof then
response.Write("<script>alert('真实姓名已存在!');history.back()</script>")
response.End()
end if
check.close
set check=nothing
dim rs
set rs=server.CreateObject("adodb.recordset")
if id<>"" then
rs.open "select * from staff where id="&id&"",conn,1,3
else
rs.open "staff",conn,1,3
rs.addnew
end if
rs("SortNum")=SortNum
rs("realname")=realname
rs("sn")=sn
rs("business")=business
rs("branch")=branch
rs("mail")=mail
rs("tel")=tel
rs("duty")=duty
rs("content")=content
rs.update
rs.close
set rs=nothing
if id<>"" then
response.Write("<script>alert('修改成功!');location='staff.asp'</script>")
else
response.Write("<script>alert('添加成功!');location='staff.asp'</script>")
end if
response.End()
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -