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


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


if move = "up" then
	sql = "select top 1 ct_idx, ct_code from member_div where   ct_code < " & ct_code & " AND ct_ref='" & ct_ref & "' order by ct_code desc"

Elseif move = "down" then
	sql = "select top 1 ct_idx, ct_code from member_div where ct_code > " & ct_code & " AND ct_ref='" & ct_ref & "' order by ct_code"

End if
	
Set rs = dbcon.execute( sql )

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

	v_rsct_idx = rs("ct_idx")		'//-- 대체할 디비번호
	v_rsct_code = rs("ct_code")		'//-- 대체할 값


	sql1 = "update member_div set ct_code = " & ct_code & " where ct_idx = " & v_rsct_idx
	sql2 = "update member_div set ct_code = " & v_rsct_code & " where ct_idx = " & ct_idx
	
	dbcon.execute sql1
	dbcon.execute sql2


End if

If ct_ref = "0" Then ct_ref  = ""

ok_url = "write.asp?ct_idx=" & ct_ref
Call loding ("0", ok_url)

dbcon.close
Set dbcon = nothing
%>