Skip to content

BeginTransaction

The BeginTransaction function serves as a wrapper for multiple SQL statements.

This function creates a Transaction object in its execution path that can be used by the ExecuteSQL or ExecuteStoredProcedure functions.

The transaction is committed automatically after all the functions in the execution path finished executing.

If one of the SQL statements returns an error or fails to execute, all SQL statements inside the transaction are rolled back.


The type of database driver to use to connect to the database.

The supported driver types are:

  • SQL Server
  • Oracle
  • OLE DB
  • ODBC

The connection string that specifies how to connect to the database.

The isolation level for the transaction. learn more

The available options depend on the Connection type that was selected.

Isolation levelConnection type
ChaosOLE DB
Read committedOLE DB, SQL Server, Oracle, OLE DB, ODBC
Read uncommittedSQL Server, OLE DB, ODBC
Repeatable readSQL Server, OLE DB, ODBC
SerializableSQL Server, Oracle, OLE DB, ODBC

Suppose you have a sales order containing several line items that must be added to the database.

Using ExecuteSQL without BeginTransaction would create a new database connection for each item written to the database. However, by using BeginTransaction, we can add everything in the same transaction.

If something should go wrong during the creation of the order, the entire transaction would be rolled back, guaranteeing that we never end up having incomplete orders in the database. Adding many records using the same transaction will also execute a lot faster.

Steps:

  1. Add a BeginTransaction function to your Solution.
  2. Set up the database connection for the BeginTransaction function.
  3. Add your ExecuteSQL functions to your work flow.
  4. For each ExecuteSQL, set the Connection type property to ‘Use transaction’.
  5. Set the Transaction property (only displayed when Connection type property is ‘Use transaction’) to ‘BeginTransaction.Transaction’.

Wikipedia: Database transaction

Wikipedia: Isolation (database systems)