Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help me understand TableUpdate()
Message
De
31/07/1999 13:33:41
 
 
À
31/07/1999 13:07:06
Dennis Schuette
Customized Business Services, Llc
Yuma, Arizona, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00248558
Message ID:
00248566
Vues:
21
>I am using VFP5.0a.
>I have a form with several textbox's tied to Table1 and a grid tied to Table2, with buffermode=2 (Optimistic).
>My Add and Edit buttons have a 'Begin Transaction' and the Revert button has 'Rollback'.
>The Save button with the following code:
>if TableUpdate()
> end transaction
>else
> **other code
>endif
>
>The problem is, when Saveing, changes to table1 fields are written, table2 changes are lost as soon as it is closed. I solved the problem by issuung:
>=TABLEUPDATE(1, .T., 'Table2')
>
>1. Why is this necessary? Is this because Table2 is in a Grid?
>
>2. If this is necessary, I want to add something like the following to my class that includes my Add, Edit, Save, and Revert buttons similar to:
>for ct=1 to NumberOfTablesInDataenvironment
> =TABLEUPDATE(1, .T., 'Table'+ct')
>endfor
>How do I determine the Number of and the Name of each table in the DataEnvironment?
>
>Thanks, Denis

First of all you won't want to keep the transactions open that long. Once you issue a BEGIN TRANSACTION that locks everyone else out of any of the records. until then END TRANSACTION is reached.

Probably in the save you'll want to do.
BEGIN TRANSACTION
IF TABLEUPDATE()
   END TRANSACTION
ELSE
   ROLLBACK
ENDIF
That's simplified a little bit. Also you'll probably want to use (5) optimistic table buffering instead of optimistic row buffering. <- Try this link for more information.

You have to use a tableupdate for each table. You can programatically determine each table that is open and tableupdate each within your transaciotn.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform