<%@language="vbscript" codepage="936" %>
<%path="../basedata"%>
<!--#include file="../inc/function.asp"-->
<%call Loginpower%>
<%call legalpower%>
<!--#include file="../conn/conn_data.asp"-->
<%
dim ID,classname,classorder,classopened
ID=request.querystring("ID")
classname=codedeHTML(request.form("classname"))
classorder=codedeHTML(request.form("classOrder"))
classopened=codedeHTML(request.form("classopened"))
if not idboolean(ID) and not idboolean(classorder) then response.write errorback("有错,请返回刷新页面,如果无法解决问题,请联系管理员。")
	set rs=conn_data.execute("select * from class where class_id not in("& ID &") and 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

sql="select * from class where class_id="&ID
set rs=server.createobject("adodb.recordset")
	rs.open sql,conn_data,1,3
	rs("class_order")=classorder
	rs("class_name")=classname
	rs("class_opened")=classopened

	rs.update
	rs.close
	set rs=nothing

		conn_data.begintrans
		conn_data.execute("update songs set songs_class_name='"& classname &"' where songs_class_id="& ID)
		if err.number <> 0 then
		conn_data.rollbacktrans
		err.clear
		else
		conn_data.committrans
		end if

	conn_data.close
	set conn_data=nothing
response.write msgok("修改成功！","categories_Manager.asp")

%>