Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursors and Transactions
Message
From
24/10/2003 12:51:28
 
 
To
23/10/2003 12:26:09
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00841459
Message ID:
00842268
Views:
26
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
Previous
Reply
Map
View

Click here to load this message in the networking platform