Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Begin Transaction
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00702151
Message ID:
00702158
Views:
23
Hi John,

Where you change data? Before BEGIN TRANSACTION?

MartinJ
BEGIN TRANSACTION

*-- Insert record to sales table
*-- Insert lineitems records to lineitem table
*-- Replace stock_status.qty with stock_Status - qtysold for each items
*-- Increase auto number

IF NOT llRollBack AND NOT TABLEUPDATE(.T., .F., "Sales")
   llRollBack = .T.
ENDIF
*
*
*
IF NOT llRollBack AND NOT TABLEUPDATE(.T., .F., "AutoNo")
   llRollBack = .T.
ENDIF

IF llRollBack
   AERROR(laError)

   ROLLBACK
*   TABLEREVERT(.T., "sales")
*   TABLEREVERT(.T., "lineitems")
*   TABLEREVERT(.T., "stock_status")
*   TABLEREVERT(.T., "autono")

   RETURN laError[2]
ELSE
   END TRANSACTION
   RETURN "OK-"
ENDIF
>Hi,
>I am using buffering and transaction for sales module. Once a sales transaction completed, record will be added to sales table, lineitems table and also deduct stock qty from stock_status table.
>
>Here is my code:
>
>*-- Insert record to sales table
>*-- Insert lineitems records to lineitem table
>*-- Replace stock_status.qty with stock_Status - qtysold for each items
>*-- Increase auto number
>
>BEGIN TRANSACTION
>
>IF NOT llRollBack AND NOT TABLEUPDATE(.T., .F., "Sales")
>   llRollBack = .T.
>ENDIF
>
>IF NOT llRollBack AND NOT TABLEUPDATE(.T., .F., "lineitems")
>   llRollBack = .T.
>ENDIF
>
>IF NOT llRollBack AND NOT TABLEUPDATE(.T., .F., "Stock_status")
>   llRollBack = .T.
>ENDIF
>
>IF NOT llRollBack AND NOT TABLEUPDATE(.T., .F., "AutoNo")
>   llRollBack = .T.
>ENDIF
>
>IF llRollBack
>   AERROR(laError)
>
>   ROLLBACK
>   TABLEREVERT(.T., "sales")
>   TABLEREVERT(.T., "lineitems")
>   TABLEREVERT(.T., "stock_status")
>   TABLEREVERT(.T., "autono")
>
>   RETURN laError[2]
>ELSE
>   END TRANSACTION
>   RETURN "OK-"
>ENDIF
>
>
>
>I faced problem that, if there are any unexpected disaster occured such as power failure and system hang the "TRANSACTION" is not work correctly.
>It sometime save the records partially which meant, the stock qty is deducted, autono is increased but sales and lineitems is not committed.
>
>Any ideas?
>
>Thank you
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform