<object runat="server" progid="ADODB.Recordset" id="rs"></object>
<object runat="server" progid="ADODB.Recordset" id="oRs"></object>
<object runat="server" progid="ADODB.Connection" id="dbCon"></object>
<object runat="server" progid="CDONTS.NewMail" id="objMail"></object>
<%
Response.Expires = -1
Response.AddHeader "Pragma", "no_cache"
Response.AddHeader "cache-control", "no_cache"
Const dbConStr = "Provider=SQLOLEDB.1;Initial Catalog=BIZ_INFO;Data Source=localhost;User ID=User;PWD=PW"
dbCon.Open("dbConStr")
dbCon.BeginTrans '트랜잭션을 시작
SQL = "insert into office(idx, o_name,addr) values "
SQL = SQL & " (" & request("id") & ""
SQL = SQL & ",'" & request("name") & "'"
SQL = SQL & ",'" & request("addr") & "'"
dbCon.execute SQL
If dbCon.errors.count > 0 then
dbCon.RollbackTrans '에러일 경우 이전상태로 복구
Response.write "<script language='javascript'>"&chr(13)
Response.write " alert('데이터를 저장하는중 에러가 발생하였습니다.\n관리자에게 문의하시기 바랍니다.');"&chr(13)
Response.write " history.back();"&chr(13)
Response.write "</script>"&chr(13)
dbCon.Close
Response.end
Else
dbCon.CommitTrans '에러가 없을 경우 완료
Response.write "<script language='javascript'>"&chr(13)
Response.write " alert('데이터가 성공적으로 처리되었습니다.');"&chr(13)
Response.write "</script>"&chr(13)
dbCon.Close
End If
Response.Redirect "office_list.asp
%>