adminsave.asp

来自「ASP+SQL Server的图书馆管理系统」· ASP 代码 · 共 51 行

ASP
51
字号
<!--#include File="ConnDB.asp"-->
<!--#include file="isAdmin.asp"-->
<html>
<head>
<title>保存管理员信息</title>
</head>
<body>
<%
  Dim aid,aname
  Dim sql
    
	aid = Request("userid")
	aname = Request("username")
	If Request.form("isadd")="1" Then
	  '判断此管理员是否存在
	  Set rs = Conn.Execute("Select * From Admin_Info Where Adm_Id='" & aid & "'")
	  If Not rs.Eof Then
			%>
			<script language="javascript">
				alert("已经存在此帐号!");
				history.go(-1);
			</script>
			<%
	  Else
		'创建管理员用户
		sql = "Insert Into Admin_Info(Adm_Id,Adm_Name,Adm_PWd) Values('"&aid&"','"&aname&"','111111')"
		Conn.Execute(sql)
	  End If
	Else
	   Set rs = Conn.Execute("Select * From Admin_Info Where Adm_Id='" & aid & "'")
	   If Not rs.Eof Then
			%>
			<script language="javascript">
				alert("已经存在此帐号!");
				history.go(-1);
			</script>
			<%
	  Else
		'更新管理员信息		
		sql = "Update Admin_Info set Adm_Id='"&aid&"' where Adm_Name='"&aname&"'"
		Conn.Execute(sql)
	End If
  End If
	Response.Write "<h2>管理员信息已成功保存!</h2>"
%>
</body>
<script language="javascript">
	opener.location.reload();
	setTimeout("window.close()",800);
</script>
</html>

⌨️ 快捷键说明

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