Hi, I am currently doin a stock control of a kind of cloth shop. Can you help me how can I reduce the quantity of the item by 1 when I press buy.
I need it to work like this select row from datagridview and press buy and quantity of that item is reduced by 1.
Someone help please thanks
Here you can find a screenshot of what i am talking about thanks alot. -- > http://imageshack.us/photo/my-images/23/buyje.jpg/
Loading
Jiteendra SampathiraoPosted Jul 25, 2011, 8:35 AM
When u click buy button....
Change the status of that record using update query.....(ex status=1)(status is the column name)
And when retrieving the records from database to Datagridview..use the select query like this
select asd,sdf from dt_table where status=0;
hope it help you........
Mark FenechPosted Jul 25, 2011, 8:02 AM
Praveen KumarPosted Jul 25, 2011, 7:53 AM
Mark FenechPosted Jul 25, 2011, 7:33 AM
Zoran HorvatPosted Jul 25, 2011, 7:29 AM
Zoran
Mark FenechPosted Jul 25, 2011, 7:08 AM
Zoran HorvatPosted Jul 25, 2011, 7:07 AM
That would do the job. Make sure to use item identity to select items for which you want to reduce the quantity or otherwise you run into risk of reducing quantities for more than one item.
Zoran
Mark FenechPosted Jul 25, 2011, 6:58 AM
Zoran HorvatPosted Jul 25, 2011, 6:53 AM
So buying is then done in two steps. First reserve the goods in database. This can be done by having two columns - amount and bookedAmount. Then amount available is calculated as amount-bookedAmount, and pressing the "buy" button only increases bookedAmount by 1. It also means that you must somehow store in the database that this particular user has booked amount of 1, so that you can reduce bookedAmount by 1 if this user quits buying or loses connection or somehow else fails to pay for the goods.
Once payment is complete, you write off all contents of the shopping cart by reducing bookedAmount by 1 and amount by 1 for every item in the shopping cart.
Hope this helps.
Zoran