Subject Problem with Transaction on ibo
Author mrbar2000
Hi friend,

I have a datamodule with 2 TIBOQuery (Query1, Query2) linked to
TIBODatabase (Autocommit, DefaultTransaction, tiCommitted)

Both table have required fields.

On InsertButton i do:
IboDB.StartTransaction;
Query1.Append;
Query2.Append;

On SaveButton I do:
if Query1.State in dsEditModes then
begin
Query1.Post;
Query2.Post;
end;

On BeforePost of Query1 I do:
Query1['Key'] := GetNextKey(Table, Field); // select max + 1
Query2['FkKey'] := Query1['Key'];
...

On AfterPost of Query2 I do:
IboDB.CommitRetaing

Steps to problem:
- Click InsertButton;
- Edit fields of Query1 but let a required field null;
- Edit fields of Query2;
- Click SaveButton;
- The Database return Error of required field on Query1.Post (All OK);
- The I fill the Query1 required field that show me error;
- Click SaveButton again;
- The Query1.Post happen;
- The Application try Query2.Post then, and it go to Query2.AfterPost
to execute the CommitRetaing, but....
I get the same error of required field not filled!

Sees that the transaction have the first values de Query1 before I
fill the required field. What I can do?