⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 azhiye_type.asp

📁 我同学的毕业设计源代码
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="admin_pass.asp" -->
<%
action=request("action")
if action="add" then    '添加类型
type_name=request("type_name")
if type_name="" then 
	Response.Write("<script>alert('类型不能为空,请填写!');window.location='azhiye_type.asp';</script>")
response.end
end if
set rs=conn.execute("Select * from zhiye_type Where typename='"&type_name&"'")
if not rs.eof then
	Response.Write("<script>alert('类型不能重复,请重填!');window.location='azhiye_type.asp';</script>")
response.end
else
    set rs=server.createobject("adodb.recordset")
	rs.open "select * from zhiye_type",conn,3,2
	rs.addnew
	rs("typename")=type_name
	rs.update
	Response.Write("<script>alert('类型添加成功!');window.location='azhiye_type.asp';</script>")
end if
elseif action="mdf" then   '修改类型
    type_name=request("typeedit")
if type_name="" then 
	Response.Write("<script>alert('类型不能为空,请填写!');window.location='azhiye_type.asp';</script>")
response.end
end if
set rs=conn.execute("Select * from zhiye_type Where typename='"&type_name&"'")
if not rs.eof then
	Response.Write("<script>alert('类型不能重复,请重填!');window.location='azhiye_type.asp';</script>")
response.end
else
	set rs=server.createobject("adodb.recordset")
	rs.open"select * from zhiye_type where id=" &request("id"),conn,1,3
	rs("typename")=request("typeedit")
	rs.update
	Response.Write("<script>alert('类型修改成功!');window.location='azhiye_type.asp';</script>")
end if
elseif action="del" then   '删除类型
	sql="delete from zhiye_type where id=" &request("id")
    set rs=conn.execute(sql)
	Response.Write("<script>alert('类型删除成功!');window.location='azhiye_type.asp';</script>")
end if
%>
</body>
<head>
<title>类型管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/css.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 zhiye_type where id=" &request("id")
rs.open sql,conn,1,3
%>
      <FORM name=modifyform method=post action=?action=mdf&id=<%=request("id")%>  >
        <table width="240" border="0" align=center cellpadding="1" cellspacing="2">
          <tr align="center"> 
            <td bgcolor="#ffb600">修改类别</td>
          </tr>
          <tr align="center"> 
            <td> <input name="typeedit" class="input" id="typeedit" value="<%=rs("typename")%>" size=24> 
              <input type=submit value=修改 name="submit2"> </td>
          </tr>
        </table>
      </form>
      <hr align="center" width="50%" size="1" noshade> 
      <%end if%>
      <form name="form1" method="post" action="?action=add">
        <table width="240" border="0" align="center" cellpadding="1" cellspacing="2">
          <tr align="center"> 
            <td bgcolor="#ffb600">添加新的类别</td>
          </tr>
          <tr align="center"> 
            <td> <input name="type_name" type="text" class="input" id="type_name" size="24"> 
              <input name="Submit" type="submit"  value="添加"> </td>
          </tr>
        </table>
        <%    
	        set rs=server.createobject("adodb.recordset")
			sql="select  * from zhiye_type order by id DESC"
            rs.open sql,conn,1,1					  
		%>
        <table width="240" border="0" align="center" cellpadding="1" cellspacing="2">
          <tr align="center"> 
            <td width="30" bgcolor="#ffb600">序号</td>
            <td bgcolor="#ffb600">名称</td>
            <td width="40" bgcolor="#ffb600">编辑</td>
            <td width="40" bgcolor="#ffb600">删除</td>
          </tr>
          <%do while not rs.eof%>
          <tr align="center"> 
            <td bgcolor="#eeeeee"><%=rs("id")%> </td>
            <td bgcolor="#eeeeee"><%=rs("typename")%></td>
            <td bgcolor="#eeeeee"><a href="?action=modify&id=<%=rs("id")%>">修改</a></td>
            <td bgcolor="#eeeeee"><a href="?action=del&id=<%=rs("id")%>" onClick="javascript:return confirm('确实要删除吗?')">删除</a> 
            </td>
          </tr>
          <% rs.movenext
		   loop
		   rs.close
		   set rs=nothing
		 %>
        </table>
      </form></td>
  </tr>
</table>
</body>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -