Subject Default transaction
Author Stevio
In my application, on my data module, I have a TIBDatabase component and TIBTransaction component. The DefaultTransaction and DefaultDatabase properties are set to each other.

In my code, I set the database connection to true, and then try to use ExecQuery for a TIBSQL component. This doesn't work however unless I add in code which sets the Active property of the Transaction to True.

In the DataModuleDestroy event handler, I close the database and set the Transaction to False.

However, I have read in a document at http://www.softwaredesign.co.uk/DelphiToInterbase.htm the following:

There is one conceptually strange aspect to the Transaction component. Interbase will not operate other than in the context of a Transaction. However, once the Transaction component has been hooked up (see below), there is no requirement that you activate the Start and End of the Transaction in your program. If the Transaction is in place, you are able simply to issue a database command (say, to update a record in a table), and the Transaction assumes you mean for it to start just before the command is processed, and for it to end just after the command has been processed, unless you override the default behavior with the StartTransaction and Commit/Rollback instructions. The Transaction will be committed for you when the Database is closed (or when the program is closed if that comes first).

Why then am I having to make the Transaction active? I have another application where I don't need to activate the transaction.

Thanks,
Stephen


[Non-text portions of this message have been removed]