<%@language="vbscript" codepage="936" %>
<%path="../basedata"%>
<!--#include file="../inc/function.asp"-->
<%call Loginpower%>
<%call legalpower%>
<!--#include file="../conn/conn_data.asp"-->
<%
dim ClassName,classopened
classname=codedeHTML(request.form("classname"))
classopened=codedeHTML(request.form("classopened"))

set rs=conn_data.execute("select * from class where class_name='"& classname &"'")
if not rs.eof and not rs.bof then
conn_data.close
set conn_data=nothing
response.write errorback("发现有相同的名称存在")
response.end
end if
order_id=conn_data.execute("select int(max(class_order)) from class")(0)
if isnull(order_id) then order_id=0
sql="select * from class"
set rs=server.createobject("adodb.recordset")
	rs.open sql,conn_data,2,3

	rs.addnew
	rs("class_order")=1 + order_id
	rs("class_name")=classname
	rs("class_opened")=classopened

	rs.update

	rs.close
	set rs=nothing
	conn_data.close
	set conn_data=nothing
	response.write msgok("增加成功！","categories_Manager.asp")
%>
