<!--#include virtual="inc/General.inc.asp"-->
<%
MenuCode = Replace(Request("MenuCode"),"'","''")
MenuName = Replace(Request("MenuName"),"'","''")
ListType = Replace(Request("ListType"),"'","''")
IsStop = Replace(Request("IsStop"),"'","''")
if ListType&""="" then ListType="0"
if IsStop&""="" then IsStop="0"
msg = ""
if MenuCode="" or MenuName="" then ErrorInfo "编号或名称不能为空！"
set rs = server.createobject("adodb.recordset")
rs.open "select * from Menu where MenuCode='" & MenuCode & "'",conn,1,1
if rs.eof then
	conn.execute "insert into Menu(MenuCode,MenuName,SubKey,ListType,IsStop) Values('" & MenuCode & "','" & MenuName & "',0," & ListType & ",0)"
	conn.execute "update Menu set SubKey=1 where MenuCode='" & left(MenuCode,len(MenuCode)-2) & "'"
	msg = "菜单添加成功！"
else
	conn.execute "update Menu set MenuName='" & MenuName & "',ListType=" & ListType & ",IsStop=" & IsStop & " where MenuCode='" & MenuCode & "'"
	msg = "菜单修改成功！"
end if
rs.close
set rs = nothing
CreateMenu()
CloseConnection()
ErrorInfos msg,"Menu.asp"
%>