Subject RE: [IBO] RE: help
Author Gerald W. McCaig - Efi Soft
Hi Jason,

I guess I am used to the MIDAS way, where you need a transaction for every
Query/Table. Also, I like to have more control over what is happening, and
that is why I have used two transactions. Is there a downside to doing this?
I have always been told multiple transactions keep a tighter control over
what is going on, by separating your actions.

Anyway, bottomline, I need to know how to cancel and delete items in the
DETAIL, without compromising my ability to roll everything back if the user
decides to cancel the MASTER.



-----Original Message-----
From: Jason Wharton [mailto:jwharton@...]
Sent: Wednesday, February 27, 2002 12:35 AM
Subject: Re: [IBO] RE: help


In short, what you are trying to do with transactions doesn't make any sense
to me. It would help if you told why you are using two transactions. At a
first glance it looks like you are over complicating something that should
be much more simple. Apologies that I have merely skimmed over this just
giving my impressions.

Jason Wharton
CPS - Mesa AZ

----- Original Message -----
From: "Gerald W. McCaig - Efi Soft" <gwmccaig@...>
To: <>
Sent: Tuesday, February 26, 2002 7:46 PM
Subject: [IBO] RE: help

> 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
> 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
> 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

IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________ - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to