Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Make transactional Pass Through updates
Message
De
04/05/2005 17:27:38
Charles Richard
Nvo Management Systems
Boisbriand, Québec, Canada
 
 
À
04/05/2005 16:34:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Divers
Thread ID:
01010984
Message ID:
01011073
Vues:
22
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform