<!-- #include virtual = "/common/lib/dbcon.asp" -->
<!-- #include virtual = "/common/lib/func.asp" -->
<%
Dim s_num, s_code, move
Dim sql, sql1, sql2


s_num		= InputValue( request.queryString("s_num") )		'//--일련번호
s_code		= InputValue( request.queryString("s_code") )		'//--정렬번호
move		= InputValue( request.queryString("move") )		'//--이동



if move = "up" then
	sql = "select top 1 s_num, s_code from emt_category where s_code < " & s_code & " order by s_code desc"

Elseif move = "down" then
	sql = "select top 1 s_num, s_code from emt_category where s_code > " & s_code & " order by s_code"

End if
	
Set rs = dbcon.execute( sql )

If Not( rs.bof Or rs.eof ) Then

	v_rss_num = rs("s_num")		'//-- 대체할 디비번호
	v_rss_code = rs("s_code")		'//-- 대체할 값


	sql1 = "update emt_category set s_code = " & s_code & " where s_num = " & v_rss_num
	sql2 = "update emt_category set s_code = " & v_rss_code & " where s_num = " & s_num
	
	dbcon.execute sql1
	dbcon.execute sql2


End if

If ct_ref = "0" Then ct_ref  = ""

ok_url = "write.asp"
Call loding ("0", ok_url)

dbcon.close
Set dbcon = nothing
%>