Subject Re: [IBO] How to retain iboControl values after rollback?
Author Lucas Franzen
Michael,

Why do you rollback at all?

If the data wasn't written due to an error (bei it on the cleint or the
server side) there's no need to rollback the transaction.

If you enter data for a single query there's ususally nothing to do but
a Commit.

If you want to abort inserts or updates you can use the CANCEL method of
TIB_Query. But still you can COMMIT the transaction afterwards (which is
considered to be better than doing a ROLLBACK).

Rollback is needed e.g. if you enter data in multiple tables, each
depending on another and if some insert fails and you want to cancel all
the previous inserts to other tables (within the same transaction) then
ROLLBACK is appropriate.

Luc.



"Michael Fung " schrieb:
>
> Dear All,
>
> I have a form with some edit controls binded to a Query. When I post
> changes, I will rollback if exception occur. However, this makes all
> the edit controls blank, forcing the user to type everything from
> scratch. Is it possible to retain the values after a rollback?
>
> And some of my code for reference:
> try
> datamodule.ibQuery1.Post;
> datamodule.transaction1.commit;
> except
> datamodule.transaction1.rollback;
> // display some error message here...
> end;
>
> Thanks,
> Michael
>