asp

Command 객체를 이용한 트랜잭션 처리

duraboys 2007. 5. 2. 23:45

* 저장프로시저를 사용할 경우

objDbconn.BeginTrans


set objCmd = server.createobject("adodb.command")


With objCmd
    .ActiveConnection = objDbconn
    .CommandType = adCmdStoredProc
    .CommandText = "저장프로시저 이름"
    .Parameters.Append .CreateParameter("파라미터이름", adInteger, adParamInput, "파라미터값")
    .Execute
    strResult = .Parameters("strResult")

End With

if strResult = "True" Then
    objDbconn.CommitTrans
Else
    objDbconn.RollbackTrans
End If