Export (0) Print
Expand All

API Implicit Transactions

Implicit transaction can be specified using features of the OLE DB and ODBC application programming interfaces (APIs).

OLE DB does not have a method to set the implicit transaction mode specifically.

  • Call the ITransactionLocal::StartTransaction method to start an explicit transaction.

  • When you then call either the ITransaction::Commit or ITransaction::Abort method with fRetaining set to TRUE, OLE DB completes the current transaction and goes into implicit transaction mode. The connection remains in implicit transaction mode as long as you set fRetaining on ITransaction::Commit or ITransaction::Abort to TRUE.

  • Call ITransaction::Commit or ITransaction::Abort with fRetaining set to FALSE to stop implicit transaction mode.

  • Call the SQLSetConnectAttr function with Attribute set to SQL_ATTR_AUTOCOMMIT and ValuePtr set to SQL_AUTOCOMMIT_OFF to start implicit transaction mode.

  • The connection remains in implicit transaction mode until you call SQLSetConnectAttr with Attribute set to SQL_ATTR_AUTOCOMMIT and ValuePtr set to SQL_AUTOCOMMIT_ON.

  • Call the SQLEndTran function with CompletionType set to either SQL_COMMIT or SQL_ROLLBACK to commit or roll back each transaction.

  • When SQL_AUTOCOMMIT_OFF is set by an ODBC application, the SQL Server ODBC driver issues a SET IMPLICIT_TRANSACTION ON statement.

ADO does not support implicit transactions. ADO applications use either autocommit mode or explicit transactions.

Community Additions

ADD
Show:
© 2014 Microsoft