Wednesday, March 28, 2012

Subtracting Quantities

Hi,

I have a query about updating quantity values within an website written in asp.net 1.1, vb2003 which references an access database. Basically what I want to do is when the customer confirms their order, I want then the number of items purchased to then be subtracted from the Products table in the database. Thus this ensures the number of each item in stock is kept up to date within the database.

My checkout table contains the intCartitemID (autonumber), Cart ID (random number and date value), quantity ordered and the productID for the item purchased.

The products table contains the ProductID, description, attributes, sale price and quantities in stock.

Now I assume I need to take the quantity of item purchased from the checkout table and then subtract this value from the products table. However, how do I put this idea into practice in terms of the asp.net coding ?

Any online examples of coding would help.

Thanks,

Just pass it in a SQL query

"Update productsTable set quantity = quantity - 1 where productID = " & productID


I agree with the above, except not "quantity = quantity - 1" ... but rather "quantity = quantity - @.howMuchWasOrdered"


Thanks both...Smile

0 comments:

Post a Comment