>>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
>
>
>
>BEGIN TRANSACTION
>DO CASE
> CASE NOT tableupdate (1, .T., [Table1])
> ** put display message here and check why you can't update table1
> ROLLBACK
>
> CASE NOT tableupdate (1, .T., [Table2])
> ** put display message here and check why you can't update table2
> ROLLBACK
>
> CASE NOT tableupdate (1, .T., [Table3])
> ** put display message here and check why you can't update table3
> ROLLBACK
>OTHERWISE
> END TRANSACTION
>ENDCASE
>
AFAIK we need TABLEREVERT() before ROLLBACK (if memory serves right), but very nice usage of CASE statement.
If it's not broken, fix it until it is.
My Blog