📄 department_update_x.asp
字号:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>
<!--#include file="forbidon.asp" -->
<!--#include file="conn.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" />
<title>无标题文档</title>
<link href="../imag/cs.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--#include file="top.asp" -->
<table width="80%" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="atable">
<tr>
<td bgcolor="#FFFFFF"> </td>
</tr>
</table>
</body>
</html>
<%
var id1;
if(String(Request("idx")) != "undefined"){ id1 = String(Request("idx"));}
if(String(Request("department")) != "undefined"){ cmd1__department1 = String(Request("department"));}
if(String(Request("admin1")) != "undefined"){ cmd1__admin11 = String(Request("admin1"));}
if(String(Request("admin2")) != "undefined"){ cmd1__admin21 = String(Request("admin2"));}
if(String(Request("pw1")) != "undefined"){ cmd1__pw11 = String(Request("pw1"));}
if(String(Request("pw2")) != "undefined"){ cmd1__pw21 = String(Request("pw2"));}
var rs1 = Server.CreateObject("ADODB.Recordset");
rs1.ActiveConnection = MM_conn_STRING;
rs1.Source = "SELECT departmentname FROM department WHERE departmentname='"+cmd1__department1+"' And departmentid<>"+id1+ "";
rs1.CursorType = 0;
rs1.CursorLocation = 2;
rs1.LockType = 1;
rs1.Open();
if(!rs1.EOF||!rs1.BOF)
{Response.Write("<script language='javascript'>window.alert('该部门已经存在!');history.go(-1);</script>");
Response.End();
}
if(rs1.EOF&&rs1.BOF)
{
var rs = Server.CreateObject("ADODB.Recordset");
rs.ActiveConnection = MM_conn_STRING;
rs.Source = "SELECT admin1 FROM department WHERE admin1='"+cmd1__admin11+"' And departmentid<>"+ id1 + " ";
rs.CursorType = 0;
rs.CursorLocation = 2;
rs.LockType = 1;
rs.Open();
if(!rs.EOF||!rs.BOF)
{Response.Write("<script language='javascript'>window.alert('正负责人已经存在,请换别的名称!');history.go(-1);</script>");
Response.End();
}
if(rs.EOF&&rs.BOF)
{ var rs2 = Server.CreateObject("ADODB.Recordset");
rs2.ActiveConnection = MM_conn_STRING;
rs2.Source = "SELECT admin1 FROM department WHERE admin2='"+cmd1__admin21+"' And departmentid<>"+ id1 + "";
rs2.CursorType = 0;
rs2.CursorLocation = 2;
rs2.LockType = 1;
rs2.Open();
if(!rs2.EOF||!rs2.BOF)
{Response.Write("<script language='javascript'>window.alert('副负责人已经存在,请换别的名称!');history.go(-1);</script>");
Response.End();
}
if(rs2.EOF&&rs2.BOF)
{
var cmd1 = Server.CreateObject("ADODB.Command");
cmd1.ActiveConnection = MM_conn_STRING;
cmd1.CommandText = "UPDATE department SET departmentname='"+cmd1__department1+"',admin1='"+cmd1__admin11+"',pw1='"+cmd1__pw11+"' ,admin2='"+cmd1__admin21+"' ,pw2='"+cmd1__pw21+"' WHERE departmentid="+id1+"";
cmd1.CommandType = 1;
cmd1.CommandTimeout = 0;
cmd1.Prepared = true;
cmd1.Execute();
Response.Write("<script language='javascript'>window.alert('修改成功');location=('department.asp');</script>");
rs2.Close();
}
rs.Close();
}
rs1.Close();
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -