Transaction Scope Question

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

Transaction Scope Question

Post by Zero-G. » Fri 19 Mar 2010 15:35

Hey

Using DotConnect for mySQL version BETA 5.x.102

So, I use in my VB.NET Environment Transaction Scope with code like this:

Code: Select all

            Dim tScope As New System.Transactions.TransactionScope
            Try
                Fakturieren()
                tScope.Complete()
            Catch ex As Exception
                IntelliSoft.myMessageBox.OfficeBox.Show("Es ist ein Fehler aufgetreten" & Environment.NewLine & _
                                ex.Message, VisualOPTNet.MessageCaption, _
                                MessageBoxButtons.OK, IntelliSoft.myMessageBox.OfficeMessageBoxIcon.Error)
            Finally
                tScope.Dispose()
            End Try
Where in the Sub of "Fakturieren" is a SP called, which has a return value.
With this returned value, I go on with working.
OK - So, when AFTER calling the SP an error occurs, than tScope.Complete is NOT CALLED. - But the changes made by the SP, are still set.
Is there any kind of information about this?

THX

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 22 Mar 2010 17:54

It seems like you are opening the connection object outside of your TransactionScope. As a result, the connection is not enlisted in the current transaction context. Try enlisting your connection explicitly by executing the following code inside TransactionScope:

Code: Select all

connection.EnlistTransaction(Transaction.Current);

Post Reply