RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TSQLConnection.StartTransaction Method

Initiates a new transaction in the associated database.

Pascal
procedure StartTransaction(TransDesc: TTransactionDesc); deprecated;
C++
__fastcall StartTransaction(TTransactionDesc TransDesc);

Call StartTransaction to start a new transaction against a database server that supports transactions. (MySQL servers do not support transactions.) You can check the TransactionsSupported property to determine whether the server supports transactions. If the server does not support transactions, StartTransaction does nothing. 

TransDesc describes the transaction you are starting. It lets you specify 

A user-defined transaction identifier. If the server supports nested or overlapped transactions, you can initiate multiple transactions by calling StartTransaction and providing each transaction with its own unique identifier.  

The transaction isolation level. This indicates the degree to which this transaction can "see" changes made by other transactions. 

If the transaction is successfully started, StartTransaction sets the InTransaction property to true. 

Updates, insertions, and deletions that take place after a call to StartTransaction are enlisted in that transaction until another overlapping transaction is started or until the application calls Commit to save the changes or Rollback to cancel them.

Tip: If the server does not support multiple transactions, check the status of the InTransaction property to be sure that another transaction is not already in progress.
Tip: When working with overlapped transactions, you can indicate the transaction to which a dataset belongs by setting its TransactionLevel property to the transaction identifier you assign in this method.
Note: This method has been deprecated.
 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!