Ordering Application with wrong stock
Posted on 2004-04-23
I created an ordering application that connected to MS access database. 25 users are using this application at the same time.
I usually check the stock avilabilty after the user select the item if stock avilable i insert new record in the grid without updating the stock on hand in item master table (Because the user may cancel the order or the power down).
When the user click the save button i update stock on hand field in item master table then save the order.
The problem is the time between selecting the item and update stock on hand if any other user create a new order this running order well not effect the stock at this stage.
Example I have item 1 with stock on hand 100.
If user A create an order with five different items if he select item 1 with qty 100 then the system will acept that qty. at this time (the stock still 100-user A does not save order yet) if user B create an order with same item he will find 100 unit avilable on the stock. after both users save their order the stock becom -100.
I would like to prevent that. Could you help me please?