basilhs_s
asked on
powerbuilder 11.5 transaction,rollback,commit
i am having a window with three datawindows dw_1, dw_2,dw_3
there is a push button pb_update with the following code
dw_1.update()
dw_2.update()
dw_3.update()
how can we see these statements as a transaction? if something goes wrong in any of these three lines how can we invoke a rollback statement? if there are triggers that are going to be fired in the data base what will happen with them?
i am using powerbuilder pb 11.5 and sql server 2000
there is a push button pb_update with the following code
dw_1.update()
dw_2.update()
dw_3.update()
how can we see these statements as a transaction? if something goes wrong in any of these three lines how can we invoke a rollback statement? if there are triggers that are going to be fired in the data base what will happen with them?
i am using powerbuilder pb 11.5 and sql server 2000
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
Or, try,
If dw_1.update() = 1 Then
If dw_2.update() = 1 Then
If dw_3.update() = 1 Then
Commit;
Else
Rollback;
End If
End If
End If
Cheers,
Rosh
Or, try,
If dw_1.update() = 1 Then
If dw_2.update() = 1 Then
If dw_3.update() = 1 Then
Commit;
Else
Rollback;
End If
End If
End If
Cheers,
Rosh
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks to all. both solutions were very understandable
ASKER
we tried this approach
TRY
dw_1.update()
dw_2.update()
dw_3.update()
commit;
CATCH (exception e1)
TRY
rollback;
CATCH (exception e2)
MessageBox("Rollback failed", e2.getMessage())
END TRY
MessageBox("Transaction failed", e1.getMessage())
END TRY
how can we force dw_update to fire an execption if something goes wrong?