Transaction Problem


Author
Message
dgsoft
dgsoft
StrataFrame User (141 reputation)StrataFrame User (141 reputation)StrataFrame User (141 reputation)StrataFrame User (141 reputation)StrataFrame User (141 reputation)StrataFrame User (141 reputation)StrataFrame User (141 reputation)StrataFrame User (141 reputation)StrataFrame User (141 reputation)
Group: StrataFrame Users
Posts: 93, Visits: 236
Hi,

I have a problem with transaction. I want to save data in 4 diffrent BO as "All or Nothing"

My code is







Try

BusinessLayer.TransactionBegin("PENSOLUTIONOFFICE", Data.IsolationLevel.ReadCommitted)

mmks_UpdateSFSUsers(loSFSUserBO)



lSaveResult = loSFSUserBO.Save()

If lSaveResult = MicroFour.StrataFrame.Data.SaveUndoResult.Success Then

pmks_SFSUserId = loSFSUserBO.us_pk

Dim loPSOClients As PSOClientsBO = New PSOClientsBO()

Dim lcKey As String = loSFSUserBO.DataSourceKey

loPSOClients.mmks_FillDataTableBySFSUserId(pmks_SFSUserId)

mmks_UpdatePSOClients(loPSOClients, pmks_SFSUserId)

Dim loSFSUsersXRoles As MicroFour.StrataFrame.Security.BusinessObjects.SFSUsersXRolesBO = New MicroFour.StrataFrame.Security.BusinessObjects.SFSUsersXRolesBO()

loSFSUsersXRoles.FillAllByUser(pmks_SFSUserId)

mmks_UpdateSFSUsersXRoles(loSFSUsersXRoles, pmks_SFSUserId)

Dim loSFSUsersXPermissions As MicroFour.StrataFrame.Security.BusinessObjects.SFSUsersXPermissionsBO = New MicroFour.StrataFrame.Security.BusinessObjects.SFSUsersXPermissionsBO()

loSFSUsersXPermissions.FillAllByUser(pmks_SFSUserId)

mmks_UpdateSFSUsersXPermissions(loSFSUsersXPermissions, pmks_SFSUserId)

Throw New Exception("Custom Error")

If loPSOClients.Save(True) = MicroFour.StrataFrame.Data.SaveUndoResult.Success Then

If loSFSUsersXRoles.Save(True) = MicroFour.StrataFrame.Data.SaveUndoResult.Success Then

If loSFSUsersXPermissions.Count > 0 Then

If Not loSFSUsersXPermissions.Save(True) = MicroFour.StrataFrame.Data.SaveUndoResult.Success Then

Throw New Exception("An error happen during save SFSUsersXPermissions")

End If

End If

Else

Throw New Exception("An error happen during save SFSUsersXRoles")

End If

Else

Throw New Exception("An error happen during save PSOClients")

End If

Else

Throw New Exception("An error happen during save SFSUsers")

End If



BusinessLayer.TransactionCommit("PENSOLUTIONOFFICE")



Catch ex As Exception

lcErrorMessage = ex.Message

BusinessLayer.TransactionRollback("PENSOLUTIONOFFICE")

End Try









At the middle of code I made Throw New Exception("Custom Error") - so code goes to Catch block and must Rollback transaction.

but - in my data table I can see written new values!

Why data changes was not revert?



Thanks

Denis
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
dgsoft - 15 Years Ago
Trent L. Taylor - 15 Years Ago
dgsoft - 15 Years Ago
Edhy Rijo - 15 Years Ago
dgsoft - 15 Years Ago
Edhy Rijo - 15 Years Ago
                     Try Edhy's sample...that should work.
Trent L. Taylor - 15 Years Ago
                         Yes.. the problem was - I use only 2 parameters in the...
dgsoft - 15 Years Ago
                             Great. :)
Trent L. Taylor - 15 Years Ago
                                 Glad to heard that. Good luck!
Edhy Rijo - 15 Years Ago
dgsoft - 15 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search