Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Make transactional Pass Through updates
Message
De
04/05/2005 16:34:30
 
 
À
04/05/2005 15:13:46
Charles Richard
Nvo Management Systems
Boisbriand, Québec, Canada
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:
01011049
Vues:
23
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform