Transaction scope attribute in VB.NET

I need to ensure that 2 transactions are credited to a transaction

Sub InsertOrder (order)

... insert order header SQL

.... insert order items SQL (LOOP)

End Sub

I know I can accomplish this using the transaction scope, but is there an "Attribute" for this?

Transaction.Scope ()> _
Public Sub InsertOrder (order)

End Sub
+1


a source to share


1 answer


There is a .NET attribute that can be used for transactions. However, this is more intended for distributed transactions across multiple data sources that require a two-phase commit. Attributes are part of the Enterprise Services transaction system.

The "classic" way to manage an SQL transaction was to call the BeginTransaction (), Commit (), and Rollback () methods of the SqlConnection object.



There is also a System.Transactions model based on the 'using' statement and the TransactionScope object you mentioned.

See this link for clear information on the various options.

+2


a source







All Articles