Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
When a tableupdate doesn't
Message
From
27/01/2000 08:24:05
 
 
To
26/01/2000 16:41:53
Elyse Pomerantz
Dynamic Data Concepts, Inc.
Brooklyn, New York, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00323082
Message ID:
00323468
Views:
27
>My code looks something like this:
>
>IF !TABLEUPDATE(2,.f.,"Table1") OR !TABLEUPDATE(2,.f.,"Table2") OR ;
> !TABLEUPDATE(2,.f.,"Table3")
> llError=.t.
>ENDIF
>IF llError
> ROLLBACK
>ELSE
> END TRANSACTION
>ENDIF
>
>The record is there after the TABLEUPDATE. It loses it after the END TRANSACTION.
>
>Elyse

Well, unless I'm missing something, I don't see anything specifically wrong with this code.

Not that it matters technically, but are you using record or table buffering? I prefer table buffering because it gives me more control and keeps "accidental" updates from happening.

Others might disagree but, personally, I would change the code to read somewhat like this:
llError = .F.
BEGIN TRANSACTION
IF TABLEUPDATE( 2, .F., "Table1" )
    IF TABLEUPDATE( 2, .F., "Table2" )
        IF NOT TABLEUPDATE( 2, .F., "Table3" )
            llError = .T.
        ENDIF
    ELSE
        llError = .T.
    ENDIF
ELSE
    llError = .T.
ENDIF

IF llError
   ROLLBACK
*  Do some TABLEREVERTs() here to clear the buffers
ELSE
   END TRANSACTION
ENDIF
I prefer code like this cause it seems clearer to me and I can run it in DEBUG to check each TABLEUPDATE() as they happen and whatever info I need at each TABLEUPDATE().

At this point I don't know what else to suggest. maybe someone else can give another perspective.

Bill
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Previous
Reply
Map
View

Click here to load this message in the networking platform