Hey
Can you please post a VB.NET sample where you show, how to use the new Transaction property from the DataContext.
THX
Transaction
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
Please refer to the 'Transactions' topic in our documentation:
http://www.devart.com/linqconnect/docs/ ... tions.html
Feel free to contact us if you encounter any problems with this sample, or need some other information concerning transactions in LinqConnect.
http://www.devart.com/linqconnect/docs/ ... tions.html
Feel free to contact us if you encounter any problems with this sample, or need some other information concerning transactions in LinqConnect.
Hey
Thanks for your information.
I am using the following code to save changes to my DataContext.
But I get the following error:
Local transaction can not be started while in a distributed transaction
Thx for advise
Thanks for your information.
I am using the following code to save changes to my DataContext.
Code: Select all
Dim sConnection = myContext.MaxUsedConnections
myContext.MaxUsedConnections = 1
myContext.Connection.Open()
myContext.Transaction = myContext.Connection.BeginTransaction
Try
myContext.Log = Console.Out
myContext.SubmitChanges(System.Data.Linq.ConflictMode.FailOnFirstConflict)
myContext.Transaction.Commit()
Catch ex As Exception
myContext.Transaction.Rollback()
If myContext.Connection.State = ConnectionState.Open Then
myContext.Connection.Close()
End If
Start.WriteToErrorLog(ex.Message.ToString, ex.InnerException.ToString, ex.StackTrace.ToString, MessageCaption, "Automatisch - Beim Speichern")
Dim Nochmal = IntelliSoft.myMessageBox.OfficeBox.Show(String.Format("Beim Speichern der Daten ist ein " & _
"Fehler aufgetreten!{0}Fehler: " & _
"{1}{0}Details: {2}{0}Noch einmal " & _
"probieren?", Environment.NewLine, _
ex.Message, ex.InnerException), _
MessageCaption, MessageBoxButtons.YesNo, _
IntelliSoft.myMessageBox.OfficeMessageBoxIcon.Error)
If Nochmal = DialogResult.Yes Then
Dim DidItNow As Boolean = SaveDataContext(myContext)
Return DidItNow
Else
myContext.RejectChanges()
End If
End Try
If myContext.Connection.State = ConnectionState.Open Then
myContext.Connection.Close()
End If
myContext.MaxUsedConnections = sConnection
Local transaction can not be started while in a distributed transaction
Thx for advise
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
As far as I can understand, you are executing this code inside a TransactionScope environment. Please tell us if I am correct. If yes, this is the designed behaviour: in case a local transaction could be started inside the scope of a distributed one, the latter cannot keep data integrity. For example, if the local transaction is committed, the distributed one cannot roll back these changes.
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48