📄 classsave2.asp
字号:
<!--#include file="check_login.asp"-->
<!--#include file="conn.asp"-->
<%
'=======================================
'我要用到的
'添加一级目录
'=======================================
Sub AddA()
session("errormsg")=""
session("result")=""
BigClassA=trim(replace(request.form("BigClassA"),"'","''"))
set rs = server.createobject("adodb.recordset")
rs.source = "select * from deeptree where content = '"&BigClassA&"'"
rs.open rs.source,conn,1,1
if BigClassA = "" then
errormsg=errormsg+"栏目的名称必须填写!!!<br>"
end if
if not rs.eof then
errormsg=errormsg+"栏目的名称不能重名!!!<br>"
end if
session("errormsg")=errormsg
rs.close
if errormsg="" then
set rs=Server.CreateObject("Adodb.Recordset")
sql="Select * From deeptree where (id is null)"
rs.open sql,conn,1,3
rs.addnew
rs("parentid")=0
rs("content")=BigClassA
rs("level")=1
rs.update
rs.close
set rs=nothing
session("result")="添加一级栏目成功"
end if
End Sub
'=======================================
'添加二级目录
'=======================================
Sub AddB()
session("errormsg")=""
session("result")=""
BigClassA=trim(replace(Request.Form("BigClassA"),"'","''"))
BigClassB=trim(replace(Request.Form("BigClassB"),"'","''"))
set rs=Server.Createobject("Adodb.Recordset")
rs.source="select * from deeptree where content='"&BigClassB&"' "
rs.open rs.source,conn,1,1
if BigClassA ="" then
errormsg=errormsg+"没有上级栏目不能添加二级栏目!!!<br>"
end if
if BigClassB ="" then
errormsg=errormsg+"栏目的名称必须填写!!!<br>"
end if
if not rs.eof then
errormsg=errormsg+"栏目的名称不能重名!!!<br>"
end if
session("errormsg")=errormsg
rs.close
'BigClassEN=rs("BigClassEN")
'rs.close
if errormsg="" then
set rs=Server.CreateObject("Adodb.Recordset")
sql="Select * From deeptree where (id is null)"
rs.open sql,conn,1,3
rs.addnew
rs("parentid")=BigClassA
rs("content")=BigClassB
rs("level")=1
rs.update
rs.close
set rs=nothing
session("result")="添加二级栏目成功"
end if
End Sub
'=======================================
'添加三级目录
'=======================================
Sub AddC()
session("errormsg")=""
session("result")=""
BigClassAA=trim(replace(Request.Form("BigClassAA"),"'","''"))
BigClassB=trim(replace(Request.Form("BigClassD"),"'","''"))
BigClassC=trim(replace(Request.Form("BigClassC"),"'","''"))
set rs=Server.Createobject("Adodb.Recordset")
rs.source="select * from deeptree where content='"&BigClassC&"' "
rs.open rs.source,conn,1,1
if BigClassAA ="" then
errormsg=errormsg+"没有一级栏目不能添加二级栏目!!!<br>"
end if
if BigClassB ="" then
errormsg=errormsg+"没有二级栏目不能添加三级栏目的!!!<br>"
end if
if BigClassC ="" then
errormsg=errormsg+"栏目的名称必须填写!!!<br>"
end if
if not rs.eof then
errormsg=errormsg+"栏目的名称不能重名!!!<br>"
end if
session("errormsg")=errormsg
rs.close
'BigClassEN=rs("BigClassEN")
'rs.close
if errormsg="" then
set rs=Server.CreateObject("Adodb.Recordset")
sql="Select * From deeptree where (id is null)"
rs.open sql,conn,1,3
rs.addnew
rs("parentid")=BigClassB
rs("content")=BigClassC
rs("level")=1
rs.update
rs.close
set rs=nothing
session("result")="添加三级栏目成功"
end if
End Sub
'============================================
'成功添加三级目录
'============================================
'栏目添加完必
'rlign
'===================================================
'===============================================
'删除一级栏目
'=================================================
Sub DelA()
session("result")=""
S1=trim(request.form("s1"))
if S1="请选择" then response.redirect "Class.asp"
set rs=Server.CreateObject("adodb.recordset")
rs.source="select * from deeptree where content='"&S1&"'" '一级目录
rs.open rs.source,conn,1,1
if not rs.eof then
BigID1=rs("id") '一级目录ID唯一
set rss=Server.CreateObject("adodb.recordset")
rss.source="select * from deeptree where parentid="&BigID1 '找二级目录
rss.open rss.source,conn,1,1
while not rss.eof
BigID2=rss("id")
set rsss=Server.CreateObject("adodb.recordset")
rsss.source="select * from deeptree where parentid="&BigID2 '找三级目录
rsss.open rsss.source,conn,1,1
while not rsss.eof
BigID3=rsss("id")
conn.execute("Delete From deeptree where id="&BigID3&"") '删三级目录
rsss.movenext
wend
rsss.Close
set rsss=nothing
conn.execute("Delete From deeptree where id="&BigID2&"") '删二级目录
rss.movenext
wend
rss.Close
set rss=nothing
conn.execute("Delete From deeptree where id="&BigID1&"") '删一级目录
rs.close
set rs=nothing
end if
session("result")="删除一级栏目成功"
End Sub
'====================================================
'删除一级栏目成功
'=====================================================
'===============================================
'删除二级栏目
'=================================================
Sub DelB()
session("result")=""
S2=trim(request.form("s2"))
if S2="请选择" then response.redirect "Class.asp"
set rs=Server.CreateObject("adodb.recordset")
rs.source="select * from deeptree where content='"&S2&"'" '找二级目录
rs.open rs.source,conn,1,1
if not rs.eof then
BID1=rs("id") '二级目录ID唯一
set rss=Server.CreateObject("adodb.recordset")
rss.source="select * from deeptree where parentid="&BID1 '找三级目录
rss.open rss.source,conn,1,1
while not rss.eof
BID2=rss("id")
conn.execute("Delete From deeptree where id="&BID2&"") '删三级目录
rss.movenext
wend
rss.Close
set rss=nothing
conn.execute("Delete From deeptree where id="&BID1&"") '删二级目录
rs.close
set rs=nothing
end if
session("result")="删除二级栏目成功"
End Sub
'====================================================
'删除二级栏目成功
'=====================================================
'===============================================
'删除三级栏目
'=================================================
Sub DelC()
session("result")=""
S3=trim(request.form("s3"))
if S3="请选择" then response.redirect "Class.asp"
set rs=Server.CreateObject("adodb.recordset")
rs.source="select * from deeptree where content='"&S3&"'"
rs.open rs.source,conn,1,1
if not rs.eof then
CID1=rs("id")
conn.execute("Delete From deeptree where id="&CID1&"")
rs.close
set rs=nothing
end if
session("result")="删除三级栏目成功"
End Sub
'====================================================
'删除三级栏目成功
'=====================================================
'=============================================================
'修改一级目录
'============================================================
Sub ModifyA()
session("errormsg")=""
updateA=trim(replace(request.form("updateA"),"'","''"))
updatecomm=trim(replace(request.form("updatecomm"),"'","''"))
AID=request.form("updateAID")
if updateA = "" then
errormsg=errormsg+"栏目的名称必须填写<br>"
end if
if updateA<>updatecomm then
set rs = server.createobject("adodb.recordset")
rs.source = "select * from deeptree where content='"&updateA&"'"
rs.open rs.source,conn,1,1
if not rs.eof then
errormsg=errormsg+"栏目的名称在系统中已经存在<br>"
end if
rs.close
end if
session("errormsg")=errormsg
if errormsg="" then
set rs=Server.CreateObject("Adodb.Recordset")
sql="Select * From deeptree where id="&AID
rs.open sql,conn,1,3
rs("content")=updateA
rs.update
rs.close
set rs=nothing
session("result")="修改一级栏目成功"
end if
End Sub
'================================================================
'修改一级栏目成功
'================================================================
'===================================================================
'修改二级栏目开始
'===============================================================
Sub ModifyB()
session("errormsg")=""
session("result")=""
updateB=trim(replace(request.form("updateB"),"'","''"))
updateBcomm=trim(replace(request.form("updateBcomm"),"'","''"))
updateBID=trim(request.form("updateBID"))
AClassAID=trim(request.form("AClassA"))
YESOK=trim(request.form("YESOK"))
if updateB = "" then
errormsg=errormsg+"栏目的名称必须填写<br>"
end if
if updateB<>updateBcomm then
set rs = server.createobject("adodb.recordset")
rs.source = "select * from deeptree where content='"&updateB&"'"
rs.open rs.source,conn,1,1
if not rs.eof then
errormsg=errormsg+"栏目的名称在系统中已经存在<br>"
end if
rs.close
end if
session("errormsg")=errormsg
if errormsg="" and YESOK="YES" then
set rs=Server.CreateObject("Adodb.Recordset")
sql="Select * From deeptree where id="&updateBID
rs.open sql,conn,1,3
rs("content")=updateB
rs("parentid")=AClassAID
rs.update
rs.close
session("result")="修改二级栏目成功"
else
set rs=Server.CreateObject("Adodb.Recordset")
sql="Select * From deeptree where id="&updateBID
rs.open sql,conn,1,3
rs("content")=updateB
rs.update
rs.close
session("result")="修改二级栏目成功"
end if
End Sub
'=============================================
'修改二级目录完
'====================================================================
'================================================================
'修改一级栏目成功
'================================================================
'===================================================================
'修改三级栏目开始
'===============================================================
Sub ModifyC()
session("errormsg")=""
session("result")=""
updateC=trim(replace(request.form("updateC"),"'","''"))
updateCcomm=trim(replace(request.form("updateCcomm"),"'","''"))
updateCID=trim(request.form("updateCID"))
BClassBID=trim(request.form("BClassB"))
YESOK=trim(request.form("YESOK"))
if YESOK="YES" and BClassBID="" then
Response.Write"<script luanage=javascript>"
Response.Write"history.back();"
Response.Write"alert('请选择二级栏目');"
Response.Write"</script>"
Response.end
end if
if updateC = "" then
errormsg=errormsg+"栏目的名称必须填写<br>"
end if
if updateC<>updateCcomm then
set rs = server.createobject("adodb.recordset")
rs.source = "select * from deeptree where content='"&updateC&"'"
rs.open rs.source,conn,1,1
if not rs.eof then
errormsg=errormsg+"栏目的名称在系统中已经存在<br>"
end if
rs.close
end if
session("errormsg")=errormsg
if errormsg="" and YESOK="YES" then
set rs=Server.CreateObject("Adodb.Recordset")
sql="Select * From deeptree where id="&updateCID
rs.open sql,conn,1,3
rs("content")=updateC
rs("parentid")=BClassBID
rs.update
rs.close
session("result")="修改三级栏目成功"
else
set rs=Server.CreateObject("Adodb.Recordset")
sql="Select * From deeptree where id="&updateCID
rs.open sql,conn,1,3
rs("content")=updateC
rs.update
rs.close
session("result")="修改三级栏目成功"
end if
End Sub
'=============================================
'修改三级目录完
'====================================================================
Sub Wran()
response.write result
%>
<style type="text/css">
<!--
body {
background-color: #F2F2F2;
}
-->
</style>
<body topmargin="0" leftmargin="0" rightmargin="0" <%=kkk%>>
<!--#include file="top/Ltop01.asp"-->
<br><br>
<table width="349" style="border-left: 1px solid #A4CEE4;border-top: 1px solid #A4CEE4;border-bottom: 1px solid #A4CEE4; border-right: 1px solid #A4CEE4;font-family: 宋体;font-size:10pt" border="0" cellspacing="1" cellpadding="0" align="center" bgcolor="#FFFFFF">
<tr bgcolor="#AED2E6" >
<td height="20" align="center" bgcolor="#C6BEC6" style='BORDER-BOTTOM: #333333 1px solid'><b>
<%
if session("errormsg")<>"" then
response.write("操作错误")
else
response.write session("result")
end if
%>
</b></td>
</tr>
<tr align="center">
<td height="115" bgcolor="#F2F2F2">
<font color=red><%=session("errormsg")%></font>
<% if session("errormsg")<>"" then %>
<br><br><br>
<input type="button" value=" 返 回 " onclick="javascript:history.back()">
<% else %>
<br>
<br>按确定键返回“产品列表首页”<br>
<br>
<input type="submit" value=" 确 定 " onclick="javascript:window.location='ProductsAll.asp'">
<% end if %></td>
</tr>
</table>
</body>
<% End Sub %>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -