BeginTransaction
Last updated
Last updated
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 or 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 that specifies how to connect to the database.
The available options depend on the Connection type that was selected.
Chaos
OLE DB
Read committed
OLE DB, SQL Server, Oracle, OLE DB, ODBC
Read uncommitted
SQL Server, OLE DB, ODBC
Repeatable read
SQL Server, OLE DB, ODBC
Serializable
SQL Server, Oracle, OLE DB, ODBC
Suppose you have a sales order containing several line items that must be added to the database.
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:
Add a BeginTransaction function to your Solution.
Set up the database connection for the BeginTransaction function.
Add your ExecuteSQL functions to your work flow.
For each ExecuteSQL, set the Connection type property to 'Use transaction'.
Set the Transaction property (only displayed when Connection type property is 'Use transaction') to 'BeginTransaction.Transaction'.
The isolation level for the transaction.
Using 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.