General information
Category:
Coding, syntax & commands
Title:
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
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only