Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Application Server

Create a connection object with a transaction

  • Last UpdatedJul 22, 2024
  • 1 minute read

SQLData scripts follow a typical flow written with transactions:

  1. Create a connection object.

  2. Create a transaction object by using the CreateTransaction() method of the connection object.

  3. Add one or more command objects to the transaction by using the CreateCommand() method of the transaction object.

  4. For each command object whose SQL statement contains parameters, initialize each parameter by using either the Set<Type>ParameterByName() method or the Set<Type>ParameterByIndex() method of the command object.

  5. Run the transaction object either synchronously or asynchronously.

If any of the commands fails or returns an error, the transaction and any commands that ran within the transaction are rolled back. The transaction is returned with the appropriate indicator

When transaction processing is complete, you can retrieve and modify the returned dataset for each command in the transaction that returns data. If you modify a dataset, you can save it back to the database either synchronously or asynchronously.

You can reuse transaction objects indefinitely. When finished, clean up the transaction object and command objects by calling their Dispose() methods.

TitleResults for “How to create a CRG?”Also Available in