<!-- #include virtual = "/common/lib/dbcon.asp" -->
<!-- #include virtual = "/common/lib/func.asp" -->
<%
Dim R_Fields, rs
Dim s_num, s_code, s_menuname, s_chk, s_wdate

R_Fields = "s_num, s_code, s_menuname, s_chk, s_wdate"

Call RequestAll (R_Fields, "request.form")

If s_num = "" then		'//저장


	'//순서
	'//*****************************************
	sql = "select max(s_code) as s_code from emt_category"
	'response.write sql
	'response.end
	Set rs = dbcon.execute( sql )

	s_code = rs("s_code")

	if IsNull( s_code ) or s_code = "" then
		s_code = 1
	else
		s_code = s_code + 1
	End if
	'//*****************************************



	
	R_Fields_i = "s_code, s_menuname, s_chk, s_wdate"
	
	s_wdate = getDateFm(Now(), 3)
	
	Call InsertQuery (R_Fields_i, "emt_category")
	
	ok_url = "write.asp?s_num=" & ct_ref


Else		'//수정

	
	R_Fields = "s_menuname, s_wdate"

	s_wdate = getDateFm(Now(), 3)

	Call UpdateQuery (R_Fields, "emt_category", "where s_num=" & s_num)


	If ct_ref = "0" then ct_ref = ""

	ok_url = "write.asp?s_num=" & ct_ref


End if

dbcon.close
Set dbcon = nothing

Call loding("0",ok_url)


%>