📄 list_class.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
response.buffer=true
if request.cookies("flag")="" then
response.write "<script>top.location.href=""login.asp"";</script>"
response.end
end if
%>
<!--#include file="dbconn.asp"-->
<%
dim action
action=request("action")
id=request("id")
classname=request.Form("classname")
if action="edit" then
set rs=server.CreateObject("adodb.recordset")
sql="select * from class where id="&id
rs.open sql,conn,1,3
rs("class")=classname
rs.update
rs.close
set rs=nothing
response.Write("修改成功!")
'response.end
end if
if action="add" then
set rs=server.Createobject("adodb.recordset")
sql="select * from class"
rs.open sql,conn,1,3
rs.addnew
rs("class")=classname
rs.update
rs.close
set rs=nothing
response.write("新分类添加成功!")
end if
if action="del" then
classid=request("classid")
set rs=server.Createobject("adodb.recordset")
sql="select * from yewu where [项目] like '"&classid&"' "
rs.open sql,conn,1,3
if not rs.eof then
response.write "此业务已经开展,不能删除!"
else
set rs2=conn.execute("delete * from class where id="&id)
set rs2=nothing
end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="css/style.css" type=text/css rel=stylesheet>
<title>分类管理</title>
</head>
<body>
<form name="form2" method="post" action="list_class.asp?action=add">
<div align="center"><font color="#808080" style="font-size: 9pt"> <strong>添加新分类:</strong>
<input name="classname" id="classname" style="border: 1 solid #808080" size="30">
<input type="submit" name="Submit2" value="添加">
</font> </div>
</form>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#CCCCCC" width="100%" id="AutoNumber1">
<tr bgcolor="#CCCCCC">
<td width="33%" height="20"> <div align="center"><strong>序号</strong></div></td>
<td width="33%"> <div align="center"><strong>业务名称 </strong></div></td>
<td width="34%"><div align="center"><strong>操作</strong></div></td>
</tr>
<%
set rs=server.CreateObject("ADODB.recordset")
sql="select * from class order by id"
rs.open sql,conn,1,3
do while not rs.eof
%>
<form name="form1" method="post" action="list_class.asp?id=<%=rs("id")%>&action=edit">
<tr>
<td width="33%" height="27"> <div align="center"><font color="#808080" style="font-size: 9pt">
<input name="id" id="id" style="border: 1 solid #808080" VALUE="<%=rs("id")%>" size="10">
</font></div></td>
<td width="33%"> <font color="#808080" style="font-size: 9pt">
<input name="classname" id="classname" style="border: 1 solid #808080" VALUE="<%=rs("class")%>" size="30">
</font>
<div align="center"></div></td>
<td width="34%"><div align="center">
<input type="submit" name="Submit" value="修改">
<input type="button" name="Submit3" onclick="location.href='list_class.asp?action=del&id=<%=rs("id")%>&classid=<%=rs("class")%>'" value="删除">
</div></td>
</tr>
</form>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -