Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Make transactional Pass Through updates
Message
From
04/05/2005 17:27:38
Charles Richard
Nvo Management Systems
Boisbriand, Quebec, Canada
 
 
To
04/05/2005 16:34:30
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Miscellaneous
Thread ID:
01010984
Message ID:
01011073
Views:
21
Thanks, I'll try it out.
Charles Richard
>Hello,
>
>here's some pseudo transaction code:
>
>
>
>SQLSETPROP(nConnectionHandle,'Transactions',2) && enable manual transactions
>
>LOCAL lbSuccess, laError[1]
>lbSuccess = .F.
>DO CASE
> CASE SQLEXEC(nConnectionHandle,'UPDATE ...') = -1
> CASE SQLEXEC(nConnectionHandle,'UPDATE 2 ..') = -1
> CASE SQLEXEC(nConnectionHandle,'DELETE ...') = -1
> OTHERWISE && will be exectud if all goes well
>  lbSuccess = .T.
>ENDCASE
>
>IF lbSuccess
>  IF SQLCOMMIT(nConnectionHandle) = 1
>   ? "Transaction commited successful"
>  ELSE
>   AERROR(laError)
>   && handle error here
>  ENDIF
>ELSE
> AERROR(laError) && saves error from SQLEXEC
> IF SQLROLLBACK(nConnectionHandle) = 1
>  ? "unsuccessful transaction rolled back"
> ELSE
>  ? "Error on rolling back transaction"
> ENDIF
> && handle error here
>ENDIF
>&& set transaction handling to automatic again
>SQLSETPROP(nConnectionHandle,'Transactions',1)
>
>
>
>
>Regards
>Christian
Charles Richard
NVO Management Systems
crichard@nvo.ca
Previous
Reply
Map
View

Click here to load this message in the networking platform