<!--#include file="conn.asp"-->
<%
id=request("id")
anclass=request.QueryString("anclass")
action=request.QueryString("action")
tid=request("tid")

'//添加新数据
select case action
case "add"
if request("id")<>"" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from com_class",conn,1,3
rs.AddNew
rs("type")=tid
rs("ClassNamecn")=trim(request("ClassNamecn2"))
rs("ClassNameEn")=trim(request("ClassNameEn2"))
rs("ClassNameutf")=trim(request("ClassNameutf2"))
rs("pid")=int(request("pid2"))
rs("cid")=int(request("id"))
rs("type")=tid
rs.Update
rs.Close
set rs=nothing
response.redirect "book_nclass.asp?id="&id&"&anclass="&anclass&"&tid="&tid&""
else
Response.Write "<script>alert('请先选择大类后，再点添加');location.href=""book_nclass.asp?tid="&tid&""";</script>"
end if

'//修改数据
case "edit"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from com_class where id="&request.QueryString("nid"),conn,1,3
rs("type")=tid
rs("ClassNamecn")=trim(request("ClassNamecn"))
rs("ClassNameEn")=trim(request("ClassNameEn"))
rs("ClassNameutf")=trim(request("ClassNameutf"))
rs("pid")=int(request("pid"))
rs("type")=tid
rs.update
rs.close
set rs=nothing
response.redirect "book_nclass.asp?id="&id&"&anclass="&anclass&"&tid="&tid&""

'//删除数据
case "del"
id=request.QueryString("id")
conn.execute ("delete from com_class where id="&request.QueryString("nid"))
conn.execute ("delete from com_books where nid="&request.QueryString("nid"))
response.redirect "book_nclass.asp?id="&id&"&anclass="&anclass&"&tid="&tid&""
end select
%>