Hi Eurico,

The following is an abridged quote from Nancy Folsom on VFUG which I printed
out and use whenever I need.  It has always worked for me.  Two points:
 a) only use transactions when you have modified more than one table and the
modifications depend on each other.  An example would be transferring money
between accounts, it is essential that if the money is taken from one
account that it is added to the other, if one update fails then both must
fail.
b) always use table buffering.

The sequence is:

Make some data changes.
BEGIN TRANSACTION
llOK = TABLEUPDATE(2,.t.,'MyTable1','laErrors')
IF llOK
        llOK = TABLEUPDATE(2,.t.,'MyTable2','laErrors')
ELSE
        * Do something to fix the problem, perhaps just a messagebox to tell the
user
ENDIF

IF llOK
        END TRANSACTION
ELSE
        ROLLBACK
        *&* If you just want to discard the changes
        TABLEREVERT(.t.,'MyTable1')
        TABLEREVERT(.t.,'MyTable2')
        *&* alternatively you may want to put the user back into an edit screen
with instructions what to change
ENDIF

HTH

John Weller
01380 723235
07976 393631

> Hi
>
> In this case it is row buffered. I did try with table buffered and
> 1 it did not change. Tableupdate would only work when the REPLACE
> was inside the Begin Transaction. This could have ramifications,
> that's why I want to understand.
> It works if it's local. In this case it is a parent table,
> the child table didn't have this problem, go figure.
> BTW, both are local views.
>
> E.
>



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to