Subject | RE: help |
---|---|
Author | Gerald W. McCaig - Efi Soft |
Post date | 2002-02-27T02:46:50Z |
Hi Jason,
I have a question, in regards to the IBO Query & Transaction...
My application has a screen where you can create a new record, and then
multiple detail items under that record. So, I am running two transactions
on two queries. I am having a problem though. I am only committing the
changes to the detail right before I commit the changes to the master
record. The problem is, if I add a few items, then begin adding
another...but made a mistake...and need to cancel the current one or delete
one that was in error, the record still shows open and also posts when I
commit the transaction.
Let me give you a brief code overview, and maybe you can tell me where I am
going wrong...
----------------------------------------------------
if not MasterTrn.InTransaction then
MasterTrn.StartTransaction;
MasterQry.Append;
---
if not DetailQry.InTransaction then
DetailQry.StartTransaction;
DetailQry.Append;
---
[if Detail OK] DetailQry.ApplyUpdates;
---
[if Detail Cancel] DetailQry.CancelUpdates;
---
[if Detail Delete] DetailQry.Delete;
---
[When Master is Posted]...
if DetailQry.InTransaction then
DetailQry.Commit;
MasterQry.ApplyUpdates;
If MasterQry.InTransaction then
MasterQry.CommitRetaining;
---
[When Master is Canceled]...
if DetailQry.InTransaction then
DetailQry.Rollback;
MasterQry.CancelUpdates;
If MasterQry.InTransaction then
MasterQry.Rollback;
----------------------------------------------------
So, for example: I create a Master Record, I add 6 Items,
but two of them were canceled during entry, when I save
the Master, all 6 get recorded. I know that if I commit
the transaction after each detail item that it will solve
this problem, but it creates another problem because it
doesn't rollback the six records automatically if I cancel
the Master.
Any ideas? Please.
Jerry
I have a question, in regards to the IBO Query & Transaction...
My application has a screen where you can create a new record, and then
multiple detail items under that record. So, I am running two transactions
on two queries. I am having a problem though. I am only committing the
changes to the detail right before I commit the changes to the master
record. The problem is, if I add a few items, then begin adding
another...but made a mistake...and need to cancel the current one or delete
one that was in error, the record still shows open and also posts when I
commit the transaction.
Let me give you a brief code overview, and maybe you can tell me where I am
going wrong...
----------------------------------------------------
if not MasterTrn.InTransaction then
MasterTrn.StartTransaction;
MasterQry.Append;
---
if not DetailQry.InTransaction then
DetailQry.StartTransaction;
DetailQry.Append;
---
[if Detail OK] DetailQry.ApplyUpdates;
---
[if Detail Cancel] DetailQry.CancelUpdates;
---
[if Detail Delete] DetailQry.Delete;
---
[When Master is Posted]...
if DetailQry.InTransaction then
DetailQry.Commit;
MasterQry.ApplyUpdates;
If MasterQry.InTransaction then
MasterQry.CommitRetaining;
---
[When Master is Canceled]...
if DetailQry.InTransaction then
DetailQry.Rollback;
MasterQry.CancelUpdates;
If MasterQry.InTransaction then
MasterQry.Rollback;
----------------------------------------------------
So, for example: I create a Master Record, I add 6 Items,
but two of them were canceled during entry, when I save
the Master, all 6 get recorded. I know that if I commit
the transaction after each detail item that it will solve
this problem, but it creates another problem because it
doesn't rollback the six records automatically if I cancel
the Master.
Any ideas? Please.
Jerry