?? companymanager.asp
字號:
<%response.expires=0%>
<!--#include file="conn.asp"-->
<%
function strlength(inputstr)
dim length,i
length=0
for i=1 to len(inputstr)
if asc(mid(inputstr,i,1))<0 then
length=length+2
else
length=length+1
end if
next
strlength=length
end function
%>
<html>
<head>
<meta http-equiv="expires" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css>
<title>部門名稱管理/title>
</head>
<body bgcolor="#eeeeee" topmargin="5" leftmargin="5">
<br>
<center>
<font color="#ee0000" size="+1"><b>部門名稱管理</b></font><br><br>
<%
id=request("id")
companycode=trim(request("companycode"))
'-----------------------------------------------
if request("submit")="增加" and companycode<>"" then
if strlength(companycode)>11 then
response.write("<font color=red>部門名稱太長,最多只能輸入5個漢字!</font><br>")
else
set conn=opendb("conn")
set rs=server.createobject("adodb.recordset")
sql="select * from companyinfotable where companycode='" & companycode &"'"
rs.open sql,conn,1
if not rs.eof and not rs.bof then
%>
<font color=red><%=companycode%>已經(jīng)存在,請換名重試!</font><br>
<%
else
sql = "Insert Into companyinfotable (companycode) Values('"&companycode& "')"
conn.Execute sql
%>
<font color=red><%=companycode%>增加成功!</font>
<%
end if
end if
end if
'---------------------------------------------------
if request("submit")="刪除" then
set conn=opendb("conn")
sql="delete from companyinfotable where autoid="&id
conn.execute sql
%>
<font color=red><%=userlevel%>刪除成功!</font>
<%
end if
'---------------------------------------------------
if request("submit")="修改" and companycode<>"" then
if strlength(companycode)>11 then
response.write("<font color=red>部門名稱太長,最多只能輸入5個漢字!</font><br>")
else
'判斷是否有與修改的職位相同的
set conn=opendb("conn")
set rs=server.createobject("adodb.recordset")
sql="select * from companyinfotable where companycode='" & companycode&"' and autoid<>"&id
rs.open sql,conn,1
if not rs.eof and not rs.bof then
%>
<font color=red><%=companycode%>已經(jīng)存在,請換名重試!</font><br>
<%
else
sql = "update companyinfotable set companycode='" & companycode & "' where autoid=" & id
conn.Execute sql
%>
<font color=red>修改成功!</font>
<%
end if
end if
end if
%>
<table border="1" cellspacing="0" cellpadding="0">
<%
set conn=opendb("conn")
set rs=server.createobject("adodb.recordset")
sql="select * from companyinfotable"
rs.open sql,conn,1
while not rs.eof and not rs.bof
%>
<tr>
<form method="post" action="companymanager.asp">
<td>
<input type="submit" name="submit" value="刪除"></td><td><input type="hidden" name="olduserlevel" value="<%=rs("companycode")%>"><input type="hidden" name="id" value=<%=rs("autoid")%>><input type="text" name="companycode" value="<%=rs("companycode")%>" maxlength="11"></td><td><input type="submit" name="submit" value="修改"></td>
</form>
</tr>
<%
rs.movenext
wend
%>
</table>
<form method="post" action="companymanager.asp">
<input type="text" name="companycode" maxlength="11"><input type="submit" name="submit" value="增加">
</form>
</center>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -