📄 edittype.asp
字号:
<!--#include file=../conn/adodb1.asp -->
<%
if session("cjuser")="" and session("pwdd")="" then
response.write"<SCRIPT language=JavaScript>alert('你没有登录,无权进入!');"
response.write"this.location.href='error.htm';</SCRIPT>"
response.end
end if
%>
<%
action=request("action")
if action="add" then '添加类型
type_name=request("type_name")
if type_name="" then
Response.Write("<script>alert('类型不能为空,请填写!');window.location='edittype.asp';</script>")
response.end
end if
set rs=db.execute("Select * from class_type Where type='"&type_name&"'")
if not rs.eof then
Response.Write("<script>alert('类型不能重复,请重填!');window.location='edittype.asp';</script>")
response.end
else
set rs=server.createobject("adodb.recordset")
rs.open "select * from class_type",db,3,2
rs.addnew
rs("type")=type_name
rs.update
Response.Write("<script>alert('类型添加成功!');window.location='edittype.asp';</script>")
end if
elseif action="mdf" then '修改类型
type_name=request("typeedit")
if type_name="" then
Response.Write("<script>alert('类型不能为空,请填写!');window.location='edittype.asp';</script>")
response.end
end if
set rs=db.execute("Select * from class_type Where type='"&type_name&"'")
if not rs.eof then
Response.Write("<script>alert('类型不能重复,请重填!');window.location='edittype.asp';</script>")
response.end
else
set rs=server.createobject("adodb.recordset")
rs.open"select * from class_type where typeid=" &request("typeid"),db,1,3
rs("type")=request("typeedit")
rs.update
Response.Write("<script>alert('类型修改成功!');window.location='edittype.asp';</script>")
end if
elseif action="del" then '删除类型
sql="delete from class_type where typeid=" &request("typeid")
set rs=db.execute(sql)
Response.Write("<script>alert('类型删除成功!');window.location='edittype.asp';</script>")
end if
%>
</body>
<head>
<title>类型管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
-->
</style>
<link href="css/main.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0">
<br>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="200" valign="top">
<% if request("action")="modify" then
set rs=server.createobject("adodb.recordset")
sql="select * from class_type where typeid=" &request("typeid")
rs.open sql,db,1,3
%>
<FORM name=modifyform method=post action=?action=mdf&typeid=<%=request("typeid")%> >
<table width="278" border="0" align=center cellpadding="1" cellspacing="1">
<tr align="center">
<td width="259" height="30" class="bordbg">修改地区</td>
</tr>
<tr align="center">
<td height="25" class="bordbg">地区名称:
<input name="typeedit" class="input" id="typeedit" value="<%=rs("type")%>" size=24> </td>
</tr>
<tr align="center">
<td height="25" class="bordbg"><input type=submit value=修改 name="submit2">
<input type="reset" name="Submit" value="重置"></td>
</tr>
</table>
</form>
<%end if%>
<form name="form1" method="post" action="?action=add">
<table width="278" border="0" align="center" cellpadding="0" cellspacing="1">
<tr align="center" class="xiangxi">
<td width="272">添加新的地区</td>
</tr>
<tr align="center">
<td height="25" class="bordbg"> 地区名称:
<input name="type_name" type="text" class="input" id="type_name" size="24">
</td>
</tr>
<tr align="center">
<td height="25" class="bordbg"><input name="Submit" type="submit" value="添加">
<input type="reset" name="Submit" value="重置"></td>
</tr>
</table>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from class_type order by typeid DESC"
rs.open sql,db,1,1
%>
<br>
<table width="278" border="0" align="center" cellpadding="0" cellspacing="1">
<tr align="center">
<td width="30" height="30" class="fenlei"><strong>序号</strong></td>
<td height="30" class="fenlei"><strong>名称</strong></td>
<td width="40" height="30" class="fenlei"><strong>编辑</strong></td>
<td width="40" height="30" class="fenlei"><strong>删除</strong></td>
</tr>
<%do while not rs.eof%>
<tr align="center">
<td height="25" class="bordbg"><%=rs("typeid")%> </td>
<td height="25" class="bordbg"><%=rs("type")%></td>
<td height="25" class="bordbg"><a href="?action=modify&typeid=<%=rs("typeid")%>">修改</a></td>
<td height="25" class="bordbg"><a href="?action=del&typeid=<%=rs("typeid")%>" onClick="javascript:return confirm('确实要删除吗?')">删除</a> </td>
</tr>
<% rs.movenext
loop
rs.close
set rs=nothing
%>
</table>
</form></td>
</tr>
</table>
<p> </p>
<p> </p>
</body>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -