📄 product_fenlei2.asp
字号:
<%
if request.cookies("汕头商城")<>"9988" then
response.redirect "../default.asp"
end if
%>
<!--#include file="conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>汕头商城</title>
<STYLE>BODY {
FONT-SIZE: 11pt
}
TD {
FONT-SIZE: 11pt
}
a { text-decoration: none; color: #0000FF }
a:hover { text-decoration: underline; color: #FF0000 }
</STYLE>
</head>
<body leftmargin="0" topmargin="0" bgcolor="#FFFFFF" text="#000000">
<table width="750" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><iframe src=top.htm noresize scrolling=no frameborder=0 width=778 height=50 hspace="0" vspace="0" marginheight="0"></iframe>
</td>
</tr>
</table>
<br>
<table width="630" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#FFFFFF" bordercolordark="#E0E0E0" align="center">
<tr>
<td height="273" align="center"><br>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center">
<td>
<input type="button" name="submit222" value="一级分类名称管理" onClick="javascript:window.location='product_fenlei.asp'">
</td>
<td>
<input type="button" name="submit23" value="二级分类名称管理" onClick="javascript:window.location='product_fenlei2.asp'">
</td>
</tr>
</table>
<table width="600" border="0" cellspacing="3" cellpadding="4">
<tr>
<td>
<div align="center">
<%
'读取一级目录=========================================
set rs=server.createobject("adodb.recordset")
sql="select * from Class_1 "
rs.open sql,conn,1
do while not rs.eof and not rs.bof
%>
<a href="product_fenlei2.asp?Class_1_Name=<%=rs("Class_1_Name")%>"><%=rs("Class_1_Name")%></a>|
<%
rs.movenext
loop
rs.close
%>
</div>
</td>
</tr>
</table>
<br>
<%
'=====/////////////////////=/////////////////////
Class_1_Name=request("Class_1_Name")
Class_2_Name=request("Class_2_Name")
oldClass_2_Name=request("oldClass_2_Name")
id=request("id")
'-------增加一条记录--/////////////////-----------------------------
if request("submit")="增加" and Class_2_Name<>"" and Class_1_Name=""then
response.write "您好!请点击进入上面的一级分类后再增加二级分类"
end if
if request("submit")="增加" and Class_2_Name<>"" and Class_1_Name<>""then
'判断是否有与原有的名称相同
set rs=server.createobject("adodb.recordset")
sql="select Class_2_Name from Class_2 where Class_2_Name='"&Class_2_Name&"' and Class_1_Name='"&Class_1_Name&"'"
rs.open sql,conn,1
if not rs.eof and not rs.bof then
%>
<font color=#FF0000>二级分类名称<font color="#0000FF">[<%=Class_2_Name%></font>]已经存在,请选择其他名称</font><br>
<%
else
sql = "Insert Into Class_2 (Class_1_Name,Class_2_Name) Values( '"& Class_1_Name &"','"& Class_2_Name &"')"
conn.Execute sql
%>
<font color=#FF0000><%=Class_2_Name%>增加成功!</font>
<%
end if
end if
'------------------------------完成增加/////////////////---------------------
'----------------------------///////////////删除一条记录//////---------------------
if request("submit")="删除" then
sql="delete * from Class_2 where Class_2_Name= '"& oldClass_2_Name &"' and Class_1_Name='"&Class_1_Name&"'"
conn.Execute sql
%>
<font color=#FF0000><%=oldClass_2_Name%>删除成功!</font>
<%
end if
'------------------------------完成删除/////////////////---------------------
'----------------------------///////////////修改一条记录//////---------------------
if request("submit")="修改" and Class_2_Name<>"" then
'判断是否有与修改的名称相同的
set rs=server.createobject("adodb.recordset")
sql="select * from Class_2 where Class_2_Name='"& Class_2_Name &"' and Class_1_Name='"&Class_1_Name&"' and id<>" & id
rs.open sql,conn,1
if not rs.eof and not rs.bof then
%>
<font color=#FF0000>本一级分类里的二级分类名称<font color="#0000FF">[<%=Class_2_Name%>]</font>已经存在,不能修改为此名称!</font><br><br>
<%
else
sql = "update Class_2 set Class_2_Name='"& Class_2_Name &"' where id=" & id
conn.Execute sql
'修改属于此分类的商品资料
sql = "update Product set Class_2='"& Class_2_Name &"' where Class_2='"& oldClass_2_Name &"' and Class_1='"&Class_1_Name&"'"
conn.Execute sql
%>
<font color=#FF0000>[<%=Class_2_Name%>]修改成功!<br></font>
<%
end if
end if
'------------------------------完成修改/////////////////---------------------
%>
<table width="320" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
<%
set rs=server.createobject("adodb.recordset")
sql="select * from Class_2 where Class_1_Name='"&Class_1_Name&"'"
rs.open sql,conn,1
while not rs.eof and not rs.bof
%>
<tr align="center">
<form method="post" action="product_fenlei2.asp?Class_1_Name=<%=Class_1_Name%>">
<td width="65">
<input type="submit" name="submit" src style="height:14pt" value="删除">
</td>
<td width="182">
<input type="hidden" name="oldClass_2_Name" value="<%=rs("Class_2_Name")%>">
<input type="hidden" name="id" value=<%=rs("id")%>>
<input type="text" name="Class_2_Name" src style="height:13pt;BORDER-RIGHT: #eeeeee 1px solid; BORDER-TOP: #aaaaaa 1px solid; BORDER-LEFT: #aaaaaa 1px solid; BORDER-BOTTOM: #eeeeee 1px solid; BACKGROUND-COLOR: #FFFFFF; color: #FF0000" value="<%=rs("Class_2_Name")%>">
</td>
<td width="65">
<input type="submit" name="submit" src style="height:14pt" value="修改">
</td>
</form>
</tr>
<%
rs.movenext
wend
%>
</table>
<br>
<form method="post" action="product_fenlei2.asp?Class_1_Name=<%=Class_1_Name%>">
<input type="text" name="Class_2_Name">
<input type="submit" name="submit" value="增加">
</form>
</td>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -