<!--#include file="inc.asp"-->
<!--#include file="check.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="images/Admin_Style.css">
<%
act=request("act")
ClassID=request.form("Classid")
founderr=false

if act="rename" then
FunRename
elseif act="del" then
FunDel
elseif act="add" then
FunAdd
else
errmsg=errmsg+"<br>"+"<li>操作错误！请联系管理员"
founderr=true
end if

if founderr=true then
call error()
else

end if

function FunRename
SClassid=request.QueryString("SClassid")
SClass=trim(request.form("Sclass"))
if SClass="" then
errmsg=errmsg+"<br>"+"<li>栏目名称不能为空！"
call error()
Response.End
end if
set rs=server.createobject("adodb.recordset")
sql = "SELECT * FROM Sclass where Sclassid=" & SClassid
rs.Open sql,conn, 1, 3
if err.Number<>0 then
err.clear
errmsg=errmsg+"<br>"+"<li>操作错误！请联系管理员"
founderr=true
else
rs("Sclass") = Sclass
rs.Update
end if
rs.Close

'修改歌曲栏目相关名称
set rs=server.createobject("adodb.recordset")
sql = "SELECT * FROM special where Sclassid=" & SClassid
rs.Open sql,conn, 1, 3
if not rs.eof then
do while not rs.eof
rs("Sclass")=request("Sclass")
rs.movenext
loop
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
end function

function FunDel
SClassid=request("SClassid")
sql="delete from Sclass where Sclassid=" & SClassid
conn.execute sql
Rem 删除相关歌手
sql="delete from Nclass where Sclassid=" & SClassid
conn.execute sql
Rem 删除相关歌曲
sql="delete from special where Sclassid=" & SClassid
conn.execute sql
if err.Number<>0 then
err.clear
errmsg=errmsg+"<br>"+"<li>操作错误！请联系管理员"
founderr=true
end if
end function

function FunAdd
SClass=trim(request.form("SClass"))
Classid=request.QueryString("Classid")
if SClass="" then
errmsg=errmsg+"<br>"+"<li>栏目名称不能为空！"
call error()
Response.End
end if
set rs=server.createobject("adodb.recordset")
sql = "SELECT * FROM Sclass where (Sclassid IS NULL)"
rs.Open sql,conn, 1, 3
if err.Number<>0 then
err.clear
errmsg=errmsg+"<br>"+"<li>操作错误！请联系管理员"
founderr=true
else
rs.AddNew
rs("Sclass") = SClass
rs("Classid") = Classid
rs.Update
end if
rs.Close
set rs=nothing
conn.close
set conn=nothing
end function
%>
<TABLE border=0 height=100>
<TR>
<TD colSpan=2 height=25>　</TD>
</TR>
</table>
<TABLE class=tableBorder cellSpacing=1 cellPadding=3 align=center style="width:75%">
<TR>
<TH class=tableHeaderText colSpan=4 height=25><b>操 作 完 成 !</b></TH>
<tr><td class="forumRowHighlight" valign=middle colspan=2 align=center><a href="javascript:history.go(-1)"><<返回上一页</a></td></tr>
</table>
