?? deptcontrol.asp
字號:
<!--#include file="asp/sqlstr.asp"-->
<!--#include file="asp/opendb.asp"-->
<!--#include file="asp/bgsub.asp"-->
<%
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
if oabusyusername="" then
response.write("<script language=""javascript"">")
response.write("window.top.location.href='default.asp';")
response.write("</script>")
response.end
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" href="css/css.css">
<script language="javascript1.2" src="js/openwin.js"></script>
<title>file system</title>
</head>
<body bgcolor="#eeeeee" topmargin="5" leftmargin="5">
<%
call bghead()
%>
<center>
<table>
<tr>
<td><b>部門名稱管理</b>  </td>
<form method="post" action="adduser.asp">
<td>
<input type="submit" name="submit" value="增加用戶">
</td>
</form>
<form method="post" action="userlevelcontrol.asp">
<td>
<input type="submit" name="submit" value="職位名稱管理">
</td>
</form>
</tr>
</table>
</center>
<%
call bgmid()
%>
<br>
<center>
<%
dept=request("dept")
olddept=request("olddept")
id=request("id")
'-----------------------------------------------
if request("submit")="增加" and dept<>"" then
'判斷是否有與增加的部門相同的
set conn=opendb("oabusy","conn","accessdsn")
set rs=server.createobject("adodb.recordset")
sql="select * from dept where dept=" & sqlstr(dept)
rs.open sql,conn,1
if not rs.eof and not rs.bof then
%>
<font color=red><%=dept%>的部門已經存在,請選擇其他部門名</font><br>
<%
else
sql = "Insert Into dept (dept) Values( " & sqlstr(dept) & ")"
conn.Execute sql
%>
<font color=red><%=dept%>增加成功!</font>
<%
end if
end if
'---------------------------------------------------
if request("submit")="刪除" then
set conn=opendb("oabusy","conn","accessdsn")
sql="delete * from dept where dept=" & sqlstr(olddept)
conn.Execute sql
%>
<font color=red><%=dept%>刪除成功!</font>
<%
end if
'---------------------------------------------------
if request("submit")="修改" and dept<>"" then
'判斷是否有與修改的部門相同的
set conn=opendb("oabusy","conn","accessdsn")
set rs=server.createobject("adodb.recordset")
sql="select * from dept where dept=" & sqlstr(dept) & " and id<>" & id
rs.open sql,conn,1
if not rs.eof and not rs.bof then
%>
<font color=red><%=dept%>的部門已經存在,不能修改為此名稱!</font><br>
<%
else
sql = "update dept set dept=" & sqlstr(dept) & " where id=" & id
conn.Execute sql
sql = "update userinf set userdept=" & sqlstr(dept) & " where userdept=" & sqlstr(olddept)
conn.Execute sql
%>
<font color=red>修改成功!</font>
<%
end if
end if
%>
<table border="1" cellspacing="0" cellpadding="0">
<%
set conn=opendb("oabusy","conn","accessdsn")
set rs=server.createobject("adodb.recordset")
sql="select * from dept"
rs.open sql,conn,1
while not rs.eof and not rs.bof
%>
<tr>
<form method="post" action="deptcontrol.asp">
<td>
<input type="submit" name="submit" value="刪除"></td><td><input type="hidden" name="olddept" value="<%=rs("dept")%>"><input type="hidden" name="id" value=<%=rs("id")%>><input type="text" name="dept" value="<%=rs("dept")%>"></td><td><input type="submit" name="submit" value="修改"></td>
</form>
</tr>
<%
rs.movenext
wend
%>
</table>
<form method="post" action="deptcontrol.asp">
<input type="text" name="dept"><input type="submit" name="submit" value="增加">
</form>
</center>
<%
call bgback()
%>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -