Performing Transactions in ADOMD.NET
Applies To: SQL Server 2016 Preview
In ADOMD.NET, you use the AdomdTransaction object to manage transaction context for a given AdomdConnection object. This functionality allows you to run several commands within the same context. Each command will read the same data without the read data changing between each command execution.
The AdomdTransaction object only supports read-committed transactions, in which shared locks are held while the data is being read to avoid dirty reads.
The AdomdConnection is used to start the transaction. To use the transaction, commands are then run against the connection that started the transaction. When you are finished with the transaction, you can either be roll back or commit the transaction.
You create an instance of an AdomdTransaction object by calling the BeginTransaction method of the AdomdConnection object. The following example shows how to create an instance of the AdomdTransaction object:
Dim objTransaction As AdomdTransaction = objConnection.BeginTransaction() AdomdTransaction objTransaction = objConnection.BeginTransaction();
After you call the BeginTransaction method to start a transaction, you can complete the transaction by calling the Commit method of the AdomdTransaction object. If this method is called on an existing, complete transaction, an exception is thrown.