Poznámka:
Přístup k této stránce vyžaduje autorizaci. Můžete se zkusit přihlásit nebo změnit adresáře.
Přístup k této stránce vyžaduje autorizaci. Můžete zkusit změnit adresáře.
The SQL Client and OLE DB .NET providers support manual transactions in the common language runtime. In ADO.NET, you can use either of these .NET providers to control transactions.
Both providers include a set of managed objects that create a database connection, begin a transaction, and commit or roll back the transaction. The major difference between the two is their connection mechanisms. The SQL Client .NET Provider provides a set of objects that call SQL Server directly. By contrast, the OLE DB .NET Provider uses native OLE DB to enable data access.
Use the ADO.NET connection object Connection.BeginTransaction to begin a local transaction. Enlist a command in that transaction using the Transaction property of the Command object. Use the Transaction object to commit or roll back modifications made at the data source based on the success or failure of the components of the transaction.
Enlistment is automatic by default and can be disabled. If disabled, you can manually enlist. Enlist in an existing distributed transaction by using Connection.EnlistDistributedTransaction. If the entire distributed transaction is committed or rolled back, modifications made by code at the data source are committed or rolled back as well.
For a transaction example using ADO.NET, see Performing Transactions.
See Also
Manual Transactions | Automatic Transactions and .NET Framework Classes