Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
Begin Transaction ....
hi,
I have a Visual Foxpro Ver7 program which opens two databases: stock and
account.
When an invoice is issued, it will update records to tables in both
databases using the Begin..End Transaction feature (without Table Buffering). The problem is, it is unstable and sometimes there are records not being appended to the account tables or the index not being synchronised. My suspicion is because I use the
transaction processing against two different databases incorrectly. Here is a rough
sample of my updates:
BEGIN TRANSACTION
Append/Replace tables in Stock DB
..
Append/Replace tables in Account DB
..
Append/Replace tables in Stock DB
..
if no error detected
END TRANSACTION
else
ROLLBACK
endif
I can't seem to find examples in documentation that use more than one
database. Does anyone know how it is done?? Do I need to nest transactions as such:
SET DATABASES TO STOCK
BEGIN TRANSACTION
Append/Replace tables in Stock DB
..
SET DATABASES TO ACCOUNT
BEGIN TRANSACTION
APPEND/REPLACE TABLES IN STOCK DB
END TRANSACTION
..
..
Append/Replace tables in Stock DB
..
..
SET DATABASES TO ACCOUNT
BEGIN TRANSACTION
APPEND/REPLACE TABLES IN Account DB
END TRANSACTION
..
..
Append/Replace tables in Stock DB
..
IF no error detected
END TRANSACTION
ELSE
ROLLBACK
ENDIF
Thanks
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement