Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursors and Transactions
Message
De
24/10/2003 12:51:28
 
 
À
23/10/2003 12:26:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00841459
Message ID:
00842268
Vues:
27
Hi Fabio

I understand your problem, try the following code. If you have more questions ask me or if you want chat with me. My msn address is:
eiscarlosmiranda@hotmail.com

Good Luck

Carlos

 
CREATE CURSOR t1 ( f1 I )
=CURSORSETPROP("Buffering", 5, "consulta") && the most import thing in transacions
APPEND BLANK
replace f1 WITH 1


IF THISFORM.Check_data()
****/ if check is fine /*******
IF THISFORM.tables_save()
****/ if save is fine /*******
****/ do something to restore your form to original state /***
ELSE
***/ if something was wrong /*****
****/ check what happen or revert /****
IF MESSAGEBOX('Do you want to revert?.',4+32)=6
THISFORM.tables_revert()
****/ do something to restore your form to original state /***
ENDIF
ENDIF
ELSE
MESSAGEBOX('f1 i empty you must to type something?.',0)
ENDIF



PROCEDURE Check_data()
**********/ check if all values have been typed /********
IF ALL IS fine
RETURN .T.
ELSE
RETURN .F.
ENDIF
ENDPROC

PROCEDURE tables_revert()
=table_revert(.T.,.T.,'t1'))
****/ return your table to the orginal state /***
ENDPROC



PROCEDURE tables_save()
*****/ The transaction is the last step /***********
****/ when alway is fine /**********
BEGIN TRANSACTION
IF NOT (table_update(.T.,.T.,'t1'))
ROLLBACK && this not rollback the inserted record
****/ check what happen or revert /****
ELSE
END TRANSACTION
ENDIF

END TRANSACTION

ENDPROC

Carlos A. Miranda
E.I.S.lnc
President
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform