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

📄 dept_update.asp

📁 本系统无论是现在还是将来的升级的版本均免费。学生综合测评分也叫综合分或者纪律分
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="const.asp" -->

<!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" />
<link href="img/Style.css" rel="stylesheet" type="text/css" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE1 {color: #FFFFFF}
-->
</style>
</head>
<body>

<%
action=Request("action")
if action="update" then

		dept_id=Request("dept_id")
		dept_name=safeChar(Request("dept_name"))
		dept_mng=safeChar(Request("dept_mng"))
		dept_mngpwd=Request("pwd")
		truename=safeChar(Request("truename"))
		
		
		Dim rs
		Set rs = Server.CreateObject("ADODB.Recordset")
		rs.ActiveConnection = dbconn
		rs.Source = "SELECT dept_id FROM dept where (dept_name='"&dept_name&"' or dept_mng='"&dept_mng&"') and dept_id<>"&dept_id&" "
		rs.CursorType = 0
		rs.CursorLocation = 2
		rs.LockType = 1
		rs.Open()
		if  not rs.eof then 
    		Response.Write("<script language='javascript'>alert('部门名称名或负责人帐号已被占用');history.go(-1);</script>")
			response.End()
		else 
			set c = Server.CreateObject("ADODB.Command")
			c.ActiveConnection = dbconn
			c.CommandText = "update dept set dept_name='"&dept_name&"', dept_mng='"&dept_mng&"', dept_mngpwd='"&dept_mngpwd&"', truename='"&truename&"' where dept_id="&dept_id&""
			c.CommandType = 1
			c.CommandTimeout = 0
			c.Prepared = true
			c.Execute()
			Response.Write("<script language='javascript'>alert('部门:"&dept_name&" 修改成功');location=('dept.asp');</script>")
        end if
		
		rs.Close()
		Set rs = Nothing

%>

<%else
 dept_id=Request("dept_id")
 Dim rs1
		Set rs1 = Server.CreateObject("ADODB.Recordset")
		rs1.ActiveConnection = dbconn
		rs1.Source = "SELECT * FROM dept where dept_id="&dept_id&""
		rs1.CursorType = 0
		rs1.CursorLocation = 2
		rs1.LockType = 1
		rs1.Open()
		if rs1.eof then response.Write("系统错误") end if

 %>
<script language="javascript">
function chk()
{
if(document.form.dept_name.value=="") 
{alert('部门名称不能为空');return false;} 
if(document.form.dept_mng.value=="") 
{alert('负责人帐号不能为空');return false;}
if(document.form.pwd.value=="") 
{alert('负责人密码不能为空');return false;}
else 
return true;
}
</script>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<form name="form" action="" method="post" onsubmit="return chk()">
<table width="80%" border="0" align="center" cellpadding="1" cellspacing="0" class="atable1">
  <tr>
    <td colspan="6" bgcolor="#333"><span class="STYLE1">&nbsp;&nbsp;部门资料修改</span></td>
  </tr>
  <tr>
    <td width="13%" height="30" class="tdmenu"><div align="center"></div></td>
    <td width="31%" class="tdmenu"><div align="center"></div></td>
    <td width="13%" class="tdmenu"><div align="center"></div></td>
    <td width="15%" class="tdmenu"><div align="center"></div></td>
    <td width="13%" class="tdmenu"><div align="center"></div></td>
    <td width="15%" class="tdmenu"><div align="center"></div></td>
  </tr>
  <tr>
    <td class="tdmenu"><div align="center">部门名称:</div></td>
    <td class="tdmenu">
      <div align="left">
        <input name="dept_name" type="text" class="atable1" id="dept_name" value="<%=rs1(1)%>" size="30"  />
      </div></td>
    <td class="tdmenu"><div align="center">&nbsp;负责人帐号:</div></td>
    <td class="tdmenu"><div align="center">
      <input name="dept_mng" type="text" class="atable1" id="dept_mng" value="<%=rs1(2)%>" size="14" maxlength="14" />
    </div></td>
    <td class="tdmenu"><div align="center">&nbsp;负责人姓名:</div></td>
    <td class="tdmenu"><div align="center">
      <input name="truename" type="text" class="atable1" id="truename" value="<%=rs1(4)%>" size="10" maxlength="10" />
    </div></td>
  </tr>
  <tr>
    <td height="30" colspan="2" class="tdmenu"><div align="center">注:名称、负责人帐号不能和已<br />
      存在的其他部门名称、帐号同名      
    </div>
      <div align="center"></div>      <div align="center"></div>      <div align="center"></div></td>
    <td height="30" class="tdmenu">&nbsp;
      负责人密码:</td>
    <td height="30" class="tdmenu"><div align="center">
      <input name="pwd" type="text" class="atable1" id="pwd" value="<%=rs1(3)%>" size="14" maxlength="14" />
    </div></td>
    <td class="tdmenu"><div align="center"><input name="提交" type="submit" class="tdmenu" id="提交" value="提交" />
    </div></td>
    <td class="tdmenu">
      <div align="left">
        <input name="重填" type="reset" class="tdmenu" id="重填" value="重填" />
        <input type="hidden" name="action" value="update" />
        <input name="dept_id" type="hidden" id="dept_id" value="<%=rs1(0)%>" />
      </div></td>
  </tr>
</table>
</form>
<%
rs1.close
set rs1=nothing
end if%>
</body>
</html>

<%dbconn.close%>

⌨️ 快捷键说明

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