Board index » delphi » transaction control

transaction control

Hello,

I am exploring transaction control, specifically the use of Commit and
Rollback under user control. A simple test has indicated that something is
going wrong.

I have a form with a database component (connected to s simple db), a table
(associated with the database component), a datasource and a grid. Three
buttons, the first starts a transaction, puts the table into edit mode, and
alters a field. The second commits the transaction and refreshes the table,
the third rolls back the transaction and refreshes the table. I would have
expected to press the first but not have the updates applied until the
commit is pressed, giving me the option to cancel via the roll back.
However, as soon as I press the first button the entry in the grid is
modified, what's more the roll back does not appear to work.

I know this is difficult to describe, but anyone any immediate suggestions?
The code really is the simplest you could imagine.

Thanks

Stuart
s....@doc.ic.ac.uk

 

Re:transaction control


Hi,
It might be of importance to know what database you are using. I'm not quite
sure, but it seams that your database is set up for 'autocommit'. Other
possibilities... Check the datasource to disable autoedit. Furthermore, the
grid is taking action itself! So changing the cursor will commit any
updates.
As far as I can see, you should use sql with transactions. TTable has a lot
of its own behavior.

Regards Albert Drent

Quote
news.doc.ic.ac.uk <s....@doc.ic.ac.uk> wrote in message

news:8i2l90$91v$1@lux.doc.ic.ac.uk...
Quote
> Hello,

> I am exploring transaction control, specifically the use of Commit and
> Rollback under user control. A simple test has indicated that something is
> going wrong.

> I have a form with a database component (connected to s simple db), a
table
> (associated with the database component), a datasource and a grid. Three
> buttons, the first starts a transaction, puts the table into edit mode,
and
> alters a field. The second commits the transaction and refreshes the
table,
> the third rolls back the transaction and refreshes the table. I would have
> expected to press the first but not have the updates applied until the
> commit is pressed, giving me the option to cancel via the roll back.
> However, as soon as I press the first button the entry in the grid is
> modified, what's more the roll back does not appear to work.

> I know this is difficult to describe, but anyone any immediate
suggestions?
> The code really is the simplest you could imagine.

> Thanks

> Stuart
> s....@doc.ic.ac.uk

Other Threads