<!--#include virtual = "/common/lib/dbcon.asp" -->
<!--#include virtual = "/common/lib/func.asp" -->

<!--#include file = "config.asp" -->

<%

po_pk		= InputValue(request("po_pk"))
poq_idx		= InputValue(request("poq_idx"))  ' --일련번호
poq_code	= InputValue(request("poq_code")) ' --정렬번호
move		= InputValue(request("move"))   ' --이동


if move = "up" then
	sql = "select poq_idx, poq_code from poll_question where po_pk="&po_pk&" AND  poq_code < "&poq_code &" order by poq_code desc"
ElseIf move = "down" then
	sql = "select poq_idx, poq_code from poll_question where po_pk="&po_pk&" AND poq_code > "&poq_code &" order by poq_code"
End If

Set Rs = Dbcon.Execute (sql)
If Not rs.eof Then

	v_rspoq_idx  = trim(rs("poq_idx"))  ' -- 대체할 디비번호
	v_rspoq_code = trim(rs("poq_code")) ' -- 대체할 값

	sql1 = "update poll_question set poq_code = "&poq_code&" where poq_idx = "&v_rspoq_idx
	Dbcon.execute sql1
	sql2 = "update poll_question set poq_code = "&v_rspoq_code&" where poq_idx = "&poq_idx
	Dbcon.execute sql2

End If

rs.close : Set rs = Nothing
Dbcon.close

ok_url = "write_ui.asp?po_pk="&po_pk
Call loding ("0",ok_url)

%>