📄 typemanage11.asp
字号:
<% option explicit %>
<!--#include file="../function1/DBOpen.asp"-->
<%
if session("purview")<>"99999" then
response.write "错误!!您没有权限或者连接超时,请重新登陆." %>
<a href="../login.asp" target="_top">登陆</a>
<% response.end
end if
dim isedit '是否在修改状态
dim color '表格颜色
dim sql,rs,rsc
dim writer '录入员
writer=""
color=1
isedit=false
if request("action")="edit" then
isedit=true
end if
if request("action")="modify" then '**************************修改版面*********************
if trim(request("typename"))="" then
response.write "错误!版面名称不能为空! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
response.end
end if
set rs=server.createobject("adodb.recordset") '检查版面是否重名
rs.open "select * from type where typename='" & trim(request("typename")) & "'",conn,1,1
if err.number <> 0 then
response.write "数据库出错"
else if not rs.bof and not rs.eof then
response.write "错误!该版面已存在! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
response.end
end if
end if
rs.close
set rs=nothing
sql="update type set typename='" & cstr(trim(request("typename"))) & "' where typeid=" & cstr(request("typeid"))
conn.execute sql
if err.number <> 0 then
response.write "数据库操作出错:" + err.description
else %>
<script language=vbscript>
msgbox "操作成功!版面 <%=trim(request("typename"))%> 的信息已经更新!"
</script>
<%end if
end if
if request("action")="add" then '******************************添加新版面************************
if trim(request("typename"))="" then
response.write "错误!版面名称不能为空! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
response.end
end if
set rs=server.createobject("adodb.recordset") '检查版面是否重名
rs.open "select * from type where typename='" & trim(request("typename")) & "'",conn,1,1
if err.number <> 0 then
response.write "数据库出错"
else if not rs.bof and not rs.eof then
response.write "错误!该版面已存在! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
response.end
end if
end if
rs.close
set rs=nothing
sql="insert into type(typename) values('" & trim(request("typename")) & "')"
conn.execute sql
if err.number <> 0 then
response.write "数据库操作出错:" + err.description
else
set rs=server.createobject("adodb.recordset") '在新版面自动插入"无专栏文章" 专栏
rs.open "select * from type where typename='" & trim(request("typename")) & "'",conn,1,1
if not rs.bof and not rs.eof then
sql="insert into border(typeid,bordername) values(" & rs("typeid") & ",'无专栏文章')"
conn.execute sql
end if
rs.close
set rs=nothing %>
<script language=vbscript>
msgbox "操作成功!新版面 <%=trim(request("typename"))%> 的信息添加成功!"
</script>
<%end if
end if
if request("action")="del" then '**********************删除版面**********************
sql="delete from type where typeid=" & cstr(request("typeid"))
conn.execute sql
if err.number <> 0 then
response.write "数据库操作错误:" + err.description
err.clear
else
sql="delete from border where typeid=" & cstr(request("typeid")) '删除与该版相关的专栏
conn.execute sql
sql="delete from users where purview=" & cstr(request("typeid")) '删除该版的录入员
conn.execute sql
sql="delete from news where typeid=" & cstr(request("typeid")) '删除该版面下的全部新闻
conn.execute sql
%>
<script language=vbscript>
msgbox "操作成功!该版面的所有相关信息已删除!"
</script>
<% end if
end if
%><html>
<head>
<title>大类管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<div align="center"> </head> <body>
<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from type",conn,1,1
if err.number <> 0 then
response.write "数据库出错"
else
if rs.bof and rs.eof then
rs.close
response.write "目前没有任何版面"
else %>
<table border="0" width="70%" bgcolor="#000000" cellpadding="0" cellspacing="1" align="center">
<% do while not rs.eof %>
<tr>
<td width="44%" bgcolor="<% if color mod 2=0 then
response.write "#ffffff"
else
response.write "#ffffff"
end if %>"> <div align="center"><a href='typemanage.asp?typeid=<%=cstr(rs("typeid"))%>&action=edit'><%=rs("typename")%></a></div></td>
</tr>
<% rs.movenext
color=color+1
loop
end if
end if
'rs.close
set rs=nothing
%>
</table>
</div>
<p align="center"> </p>
</body>
</html>
<!--#include file="../function/DBclose.asp"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -