StrataFrame Forum
Back
Login
Login
Home
»
StrataFrame Application Framework - V1
»
Business Objects and Data Access (How do I?)
»
Transaction processing strange behavior
Transaction processing strange behavior
Post Reply
Like
2
Transaction processing strange behavior
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
Marcel Heitlager
Marcel Heitlager
posted 13 Years Ago
ANSWER
Topic Details
Share Topic
Group: StrataFrame Users
Posts: 84,
Visits: 835
Hi,
For some reason when I try to save data to two tables during a transaction save, sometimes the transaction only commits one of the tables. This is on a website. It happens when a person might put a payment through and the entire transaction fails, and rolls back for some reason. Then the person will try it again within a couple of minutes, and the transaction only commits the data to the 2nd save. See below:
'-- first generate a unique transaction key
Dim lcTransactionKey As String = AES.BOL.Base.Utils.NewSeqGuid().ToString
Try
TransactionBegin(Me.OPPaymentDetail.DataSourceKey, lcTransactionKey, IsolationLevel.ReadCommitted)
'-- First save data to the contact information table - This save Fails
Me.OPPaymentDetail.Save(True, lcTransactionKey)
'-- next get the primary key value and save to ACH detail table - This save Succeeds
Me.OPACHInfoBO.ah_op_Key = Me.OPPaymentDetail.GetPostSavePrimaryKeyValue(-1).ToString
Me.OPACHInfoBO.Save(True, lcTransactionKey)
TransactionCommit(Me.OPPaymentDetail.DataSourceKey, lcTransactionKey)
Return True
Catch ex As Exception
TransactionRollback(Me.OPPaymentDetail.DataSourceKey, lcTransactionKey)
Me.SendTransactionReportError()
Return False
End Try
It seems the 2nd transaction always commits, but the first doesn't.
It's running on SQL Server Express 2005, Windows Server 2003. Could it be some memory cache issue?
Thanks,
Marcel
Tags
Transaction Save
Transactions
Reply
Like
2
Replies
Marcel Heitlager
Marcel Heitlager
posted 13 Years Ago
ANSWER
Post Details
Share Post
Group: StrataFrame Users
Posts: 84,
Visits: 835
Thanks for you reply Edhy!
The thought didn't occur to me that I need to check for success. I always thought that the try/catch would trap for transaction failure automatically without the conditional and skip the rest.
Marcel
Edited
13 Years Ago by
Marcel Heitlager
Reply
Like
2
Edhy Rijo
E
Edhy Rijo
posted 13 Years Ago
ANSWER
Post Details
Share Post
E
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
Hi Marcel,
You are welcome!!!
Marcel Heitlager (6/19/2012)
The thought didn't occur to me that I need to check for success. I always thought that the try/catch would trap for transaction failure automatically without the conditional and skip the rest.Marcel
Well, you are right, but since you don't know why the transaction is failing, then I make myself a habit to check the saving results in most of the time either way. Bottom line is that you need to try to figure out why the transaction is failing in order to present the user with a nice message and possible instructions on how to continue after the failing transaction.
Edhy Rijo
Reply
Like
2
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Threaded View
Threaded View
Transaction processing strange behavior
Marcel Heitlager
-
13 Years Ago
Hi Marcel, Your transaction looks just fine, except that I would put...
Edhy Rijo
-
13 Years Ago
Thanks for you reply Edhy! The thought didn't occur to me that I need...
Marcel Heitlager
-
13 Years Ago
Hi Marcel, You are welcome!!! [quote][b]Marcel Heitlager...
Edhy Rijo
-
13 Years Ago
Post Reply
Like
2
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search