<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% if session("admid")="" or Session("class")<>"1" then response.redirect"login.asp"%>
<!--#include file="conn.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
-->
</style>
</head>
<%
  Select Case Request.QueryString("action")
         case "add"
		   conn.Execute("Insert into Booksort([Name]) values('"&Request.form("Name")&"')")
		   response.Redirect("?")
		 Case "edit"
		   Conn.Execute("Update Booksort set [Name]='"&Request.Form("Name")&"' where ID="&Cint(Request.QueryString("id")))
		   Response.Redirect("?")
		 Case "del"
		   Conn.Execute("delete * from booksort where ID="&cint(Request.QueryString("id")))
		   response.Redirect("?")
  End Select		       
%>
<body>
<table width="500" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#006d63" style="border-collapse: collapse">
  <tr bgcolor="#FFFFFF">
    <td height="25" colspan="2">＋学科列表</td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="25">学科名称</td>
    <td width="156" height="25">操作</td>
  </tr>
  <%
    Set Rs=Conn.Execute("Select * from BookSort order by id")
	     If Not Rs.eof then
		   Do while not rs.eof
  %>
  <form action="?action=edit&id=<%=Rs(0)%>" method="post">
  <tr bgcolor="#FFFFFF">
    <td height="25"><input type="text" name="Name" value="<%=Trim(rs(1))%>"> </td>
    <td height="25"><input type="submit" name="Submit" value="编辑">
      &nbsp;
      <input type="button" name="Submit" value="删除" onclick="window.location.href='?action=del&id=<%=Rs(0)%>'"></td>
  </tr>
  </form>
  <%
    Rs.MoveNext
	loop
	end if
	Rs.close
	Set Rs=Nothing
  %>
</table>
<p>&nbsp;</p>
<table width="500" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#006d63" style="border-collapse: collapse">
  <tr bgcolor="#FFFFFF">
    <td height="25" colspan="2">＋学科添加</td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="25">学科名称</td>
    <td width="156" height="25">操作</td>
  </tr>
  <form action="?action=add" method="post">
  <tr bgcolor="#FFFFFF">
    <td height="25"><input type="text" name="Name"></td>
    <td height="25"><input type="submit" name="Submit" value="添加"></td>
  </tr>
  </form>
</table>
</body>
</html>
