📄 infoclass.asp
字号:
<!--#include file="../Session.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../css/site.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="0">
<tr valign="middle">
<td height="40" align="center" class="tdstyle"><a href="../Sorry.asp"><font color="#000000" size="2"><strong>添加信息</strong></font></a><font color="#1478eb">
</font>|<font color="#1478eb"> </font><a href="Edit.asp"><font color="#000000" size="2"><strong>信息列表</strong></font></a></td>
</tr>
</table>
<br>
<%Dim Class1
Select case request("action")
case "amend"
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select Class from InfoClass where Class='"&request("Class")&"'"
rs.open sql,conn,0,1
For I = 1 To rs.RecordCount
Class1=rs("Class")
rs.MoveNext
if Class1=request("Class") then
Response.Write("<script>alert(""该类别已经存在!"");history.back();</script>")
Response.end
end if
Next
rs.close
conn.execute("Update InfoClass set Class= '"&request("Class")&"' where id="&request("id")&"")
conn.execute("Update Info set Class= '"&request("Class")&"' where InfoClassId="&request("id")&"")
Response.redirect "InfoClass.asp"
case "add"
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select Class from InfoClass where Class='"&request("Class")&"'"
rs.open sql,conn,0,1
For I = 1 To rs.RecordCount
Class1=rs("Class")
rs.MoveNext
if Class1=request("Class") then
Response.Write("<script>alert(""该类别已经存在!"");history.back();</script>")
Response.end
end if
Next
rs.close
conn.execute("Insert into InfoClass(Class)values('"&request("Class")&"')")
Response.redirect "InfoClass.asp"
case "del"
conn.execute("Delete From InfoClass where id="&request("id")&"")
conn.execute("Delete From Info where Infoclassid="&request("id")&"")
Response.redirect "InfoClass.asp"
End Select
%>
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="0">
<tr align="center">
<td height="50" colspan="4" class="tdstyle"><font color="#000000" size="3"><strong>分类列表</strong></font></td>
</tr>
<tr align="center">
<td width="10%" height="30" class="tdstyle"><strong>编号</strong></td>
<td width="70%" class="tdstyle"><strong>类别名称</strong></td>
<td width="10%" class="tdstyle"><strong>修改</strong></td>
<td width="10%" class="tdstyle"><strong>删除</strong></td>
</tr>
<%
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from InfoClass order by id"
rs.open sql,conn,0,1
do while not rs.eof%>
<form name="form1" method="post" action="InfoClass.asp?action=amend">
<tr bgcolor="#f1f1f1">
<td align="center" class="tdstyle"><%=rs("id")%> <input name="id" type="hidden" id="id" value="<%=rs("id")%>">
</td>
<td align="center" class="tdstyle"> <input name="Class" type="text" class="input1" id="Class" value="<%=rs("Class")%>" size="60">
</td>
<td align="center" class="tdstyle"> <input name="Submit" type="submit" class="button2" value="修改"></td>
<td align="center" class="tdstyle"> <input name="Submit2" type="button" class="button3" value="删除" onclick="window.location='InfoClass.asp?action=del&id=<%=rs("id")%>'"></td>
</tr>
</form>
<%rs.movenext
loop
rs.close
%>
</table>
<p align="center"> </p>
<form action="InfoClass.asp?action=add" method="post" name="myform" id="form">
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr align="center" valign="middle">
<td height="50" class="tdstyle"><font color="#000000" size="3"><strong>添加分类</strong></font></td>
</tr>
<tr>
<td align="center" class="tdstyle">分类:
<input name="Class" type="text" class="input1" id="Class" size="60">
</td>
</tr>
<tr valign="middle">
<td height="30" align="center" class="tdstyle">
<input name="Submit3" type="submit" class="button" value="提交"></td>
</tr>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -