SDAC

TCustomDAConnection.StartTransaction Method

Begins a new user transaction.

Class

TCustomDAConnection

Syntax

procedure StartTransaction; virtual;

Remarks

Call the StartTransaction method to begin a new user transaction against the database server. Before calling StartTransaction, an application should check the status of the InTransaction property. If InTransaction is True, indicating that a transaction is already in progress, a subsequent call to StartTransaction without first calling Commit or Rollback to end the current transaction raises EDatabaseError. Calling StartTransaction when connection is closed also raises EDatabaseError.

Updates, insertions, and deletions that take place after a call to StartTransaction are held by the server until an application calls Commit to save the changes, or Rollback to cancel them.

In SQL Server real transaction begins only on the first execute of data modification SQL statement.

Note: In some cases TCustomMSDataSet.FetchAll may conflict with transaction control (EOLEDBError 'Cannot create new connection because in manual or distributed transaction mode.') or may cause deadlocking on Post on editing queries with ORDER BY clause.

Also no transactions can be started and there are underfetched datasets within the connection.

See Also

© 1997-2024 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback