<!--#include file="conn.asp"-->
<!--#include file="../include/py.asp"-->
<%if session("bjxadmin")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆！');window.location.href='login.asp';</script>"
response.End
else
if session("flag")>1 then
response.Write "<p align=center><font color=red>您没有此项目管理权限！</font></p>"
response.End
end if
end if
%>
<%dim action,url,i,abc,anclassid,anclass
anclassid=request("anclassid")
anclass=request.QueryString("anclass")
url="http://" & Request.ServerVariables("http_host") & finddir(Request.ServerVariables("url"))
action=request.QueryString("action")
'//添加新数据
select case action
case "add"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * FROM BJX_class2",conn,1,3
rs.AddNew
rs("nclass")=trim(request("nclass2"))
rs("nclassidorder")=int(request("nclassidorder2"))
rs("anclassid")=int(request("anclassid"))
rs("py")=left(c(trim(request("nclass2"))),1)
'rs("changyong")=int(request("changyong"))
rs.Update
rs.Close
set rs=nothing
response.redirect url&"nclass.asp?id="&anclassid&"&anclass="&anclass
'//修改数据
case "edit"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * FROM BJX_class2 where nclassid="&request.QueryString("id"),conn,1,3
rs("nclass")=trim(request("nclass"))
rs("nclassidorder")=int(request("nclassidorder"))
rs("py")=trim(request("py"))
'rs("changyong")=int(request("changyong"))
rs.update
rs.close
set rs=nothing
response.redirect url&"nclass.asp?id="&anclassid&"&anclass="&anclass
'//删除数据
case "del"
anclassid=request.QueryString("anclassid")
conn.execute ("delete FROM BJX_class2 where nclassid="&request.QueryString("id"))
conn.execute ("delete from BJX_goods where nclassid="&request.QueryString("id"))
response.redirect url&"nclass.asp?id="&anclassid&"&anclass="&anclass
end select
%>
<%
Function finddir(filepath)
	finddir=""
	for i=1 to len(filepath)
	if left(right(filepath,i),1)="/" or left(right(filepath,i),1)="\" then
	  abc=i
	  exit for
	end if
	next
	if abc <> 1 then
	finddir=left(filepath,len(filepath)-abc+1)
	end if
end Function
%>
