Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Several tableupdates
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01324687
Message ID:
01324691
Vues:
12
>I am using 3 tables
>
>All 3 are cursors in my form dataenvironment buffered as 5
>
>At the save buttom I have this lines
>
>***save 1
> select table1
> = tableupdate (.T.)
>
>*** save2
> select table2
> = tableupdate (.T.)
>
>*** save3
> select table3
> = tableupdate (.T.)
>
>
>Suppose that one of the "saves" above fails
>Two tables will be saved and this will lead to severe erros, even if a warning message is displayed to my users
>
>Is there a way to revert all if one of the tables fail ?
>
>
>Moises

USE Transaction, e.g. pseudo-code
BEGIN TRANSACTION

   llSuccess =  Tableupdate(.t., .t., 'Alias1')
   llSuccess = m.llSuccess AND tableupdate(...) 
   llSuccess = m.llSuccess AND and tableupdate(...)
   if m.llSuccess
      END TRANSACTION
   ELSE
     tablerevert()
    ROLLBACK
  endif
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform