Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Connection handle Best practice
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00890192
Message ID:
00890252
Vues:
26
>You can use VFP transactions with SQL transactions, so you can rollback the VFP remote view if the SQL update fails. At that point, you're not actually rollingback any "real" data changes with the VFP transaction, but just whether the cursor thinks it's updated the back-end and the oldval() values.

To expand on that, if you're updating multiple cursors, you really do need to tie together your tableupdates() and SQL transactions within a VFP transaction. Otherwise if you're updating multiple cursors and #3 fails, cursor #1 and #2 would be out of sync with SQL Server. Of course, with only one tableupdate(), this wouldn't be necessary since the one and only tableupdate would fail.

So:
SQLSETPROP(lnhandle,"Transactions",2) &&set to manual
BEGIN TRANSACTION
IF tableupdate() and tableupdate() and tableupdate()
SQLCommit(lnhandle)
END TRANSACTION
else
sqlrollback(lnhandle)
ROLLBACK
endif
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform