⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 add.asp

📁 设置员工上下班时间
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>新增员工信息</title>
</head>
<!--#include file="connection.asp"-->
<body> 
<form id="form1" name="form1" method="post" action="add.asp?action=Chkadd">
<table width="285" border="1" align="center">
  <tr>
    <td width="72"><div align="right">姓名:</div></td>
    <td width="197">      
      <input type="text" name="name" id="name"/>
          </td>
  </tr>
  <tr>
    <td><div align="right">性别:</div></td>
    <td>
      <select name="sex" id="sex">
        <option value="0">男</option>
        <option value="1">女</option>
      </select>
   </td>
  </tr>
  <tr>
    <td><div align="right">部门:</div></td>
    <td><input type="text" name="job" /></td>
  </tr>
  <tr>
    <td><div align="right">账号:</div></td>
    <td><input type="text" name="account" /></td>
  </tr>
  <tr>
    <td><div align="right">密码:</div></td>
    <td><input type="text" name="password" /></td>
  </tr>
  <tr>
    <td colspan="2"><div align="right">         
          <input type="submit" name="Submit" value="保存" />              
      </div></td>
  </tr>
</table>
</form>
<%
  If Request("action")="Chkadd" Then 
     Call Chkadd()
  End If
%>

<%
Sub Chkadd()

name=trim(Request("name"))
sex=trim(Request("sex"))
job=trim(Request("job"))
account=trim(Request("account"))
password=trim(Request("password"))

if len(name)<1 then
Response.Write "<script>alert('请输入员工姓名!');history.go(-1);</script>"

elseif len(job)<1 then
Response.Write "<script>alert('请输入员工部门!');history.go(-1);</script>"

elseif len(account)<1 then
Response.Write "<script>alert('请输入员工账号!');history.go(-1);</script>"

elseif len(password)<1 then
Response.Write "<script>alert('请输入员工密码!');history.go(-1);</script>"

else
Set rs=Server.CreateObject("ADODB.Recordset")
strsql="select *from employee where account='"&account&"'"
strsql=strsql+"order by name desc"
rs.Open strsql,con,1,3
  if rs.EOF then
strsql="insert into employee"
strsql=strsql+"(name,sex,job,account,password)"
strsql=strsql+"values('"&name&"','"+sex+"','"&job&"','"&account&"','"&password&"')"      
   con.Execute strsql
Response.Write "<script>alert('新增员工信息成功!');history.go(-1);</script>"
  else
Response.Write "<script>alert('帐号已存在!');history.go();</script>"   
    
  end if
end if 
  
end Sub
%>
</body>
</html>

⌨️ 快捷键说明

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