Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to make sure data accuracy?
Message
From
02/01/2001 09:56:22
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
How to make sure data accuracy?
Miscellaneous
Thread ID:
00458440
Message ID:
00458440
Views:
52
Hi,
I am developing POS and inventory system. How could I make sure data accuracy in application during sales and stock deduction in Multiuser mode?
I am using table buffering in my module.
I have the following code in my module. I am not sure that my code can guarantee the accuracy of stock amount.
Since i am using buffering, after I doing UPDATE-SQL (which will minus the current stock balance with sales item count), the stock balance may be changed by other user before I issue TABLEUPDATE().
How to guarantee the balance is accurate?

Thank you
USE salestable AGAIN SHARED IN 1
CURSORSETPRO("buffering", 5)

USE stocktable AGAIN SHARED IN 2
CURSORSETPRO("buffering", 5)

**do watever to search records
UPDATE stocktable SET stockbalance = stockbalance - salesItemCount 
     WHERE stockID = itemID

BEGIN TRANSACTION

** update all table

IF alltableOK
   END TRANSACTION
ELSE
   ROLLBACK
   **REVERT ALL CHANGES
ENDIF
I am not the most powerful man in this world.
I am not the worst man in this world either.
I just as same as all of you.
I still need to learn from my mistakes...
Next
Reply
Map
View

Click here to load this message in the networking platform