K
Kumar
Hi,
Could any one pls tell me how this rollback transaction works. I need
to call TestProc stored procedure(it has got its own transaction). I
want to rollback in my ASP.net code even if the TestProc executes
successfully.
The follg is the code part which I'm using. It is executing the
Rollback stt in the finally block but still it is not rolling back.
I'm using Oracle 8.1.7 client and the server is Oracle 7.3
Pls help me!!!
Many thanks.
-------------------------------------------------------
Dim cmdXX As OracleCommand
Dim conOra As New OracleConnection(ConnString)
Dim trnOra As OracleTransaction
conOra.Open()
trnOra = conOra.BeginTransaction()
Try
' Get Oracle Connection.
cmdRegisterCandidate = New OracleCommand("TestProc", conOra,
trnOra)
cmdRegisterCandidate.CommandType = CommandType.StoredProcedure
With cmdXX
.Parameters.Add(New OracleParameter("UserName", OracleType.VarChar,
20))
.Parameters("UserName").Direction =
ParameterDirection.Input
.Parameters("UserName").Value = sUsername
.Parameters.Add(New OracleParameter("IPAddress", OracleType.VarChar,
15))
.Parameters("IPAddress").Direction =
ParameterDirection.Input
.Parameters("IPAddress").Value = sIPAddress
.Parameters.Add(New OracleParameter("Err", OracleType.VarChar, 100))
.Parameters("Err").Direction =
ParameterDirection.Output
.ExecuteNonQuery()
End With
Catch ex As Exception
WriteToLog(......)
Finally
trnOra.Rollback()
conOra.Close()
End Try
-------------------------------------------------------
Could any one pls tell me how this rollback transaction works. I need
to call TestProc stored procedure(it has got its own transaction). I
want to rollback in my ASP.net code even if the TestProc executes
successfully.
The follg is the code part which I'm using. It is executing the
Rollback stt in the finally block but still it is not rolling back.
I'm using Oracle 8.1.7 client and the server is Oracle 7.3
Pls help me!!!
Many thanks.
-------------------------------------------------------
Dim cmdXX As OracleCommand
Dim conOra As New OracleConnection(ConnString)
Dim trnOra As OracleTransaction
conOra.Open()
trnOra = conOra.BeginTransaction()
Try
' Get Oracle Connection.
cmdRegisterCandidate = New OracleCommand("TestProc", conOra,
trnOra)
cmdRegisterCandidate.CommandType = CommandType.StoredProcedure
With cmdXX
.Parameters.Add(New OracleParameter("UserName", OracleType.VarChar,
20))
.Parameters("UserName").Direction =
ParameterDirection.Input
.Parameters("UserName").Value = sUsername
.Parameters.Add(New OracleParameter("IPAddress", OracleType.VarChar,
15))
.Parameters("IPAddress").Direction =
ParameterDirection.Input
.Parameters("IPAddress").Value = sIPAddress
.Parameters.Add(New OracleParameter("Err", OracleType.VarChar, 100))
.Parameters("Err").Direction =
ParameterDirection.Output
.ExecuteNonQuery()
End With
Catch ex As Exception
WriteToLog(......)
Finally
trnOra.Rollback()
conOra.Close()
End Try
-------------------------------------------------------