Author: mattatuni2 | Posted on: 2/15/2009 12:07:50 PM | Views : 335


I have a datatable(similar idea to a shopping cart) held in a session variable that hold several columns,

A number of products are added to the datatable each row includes the productID and the quantity baught..

When I click a button I want to ammend the stock table dependamt on whats in the datatable

eg if in datatable one row has productID 3, and Qty 3, I want to reduce the qty in stock in my stock table for ProductId
by 3.


I understand how to do it from labels or textboxes for one record, but i am struggeling with a data table..
I take it I will have to use some sort of loop to go through the datatable row by row??

below is how the sql statment should look (i think)

where *qty is the qty specified in the current datatable row
and *ItemId is the item/product ID in the current row


update tblstock
set qty as qty - *qty
where item ID = *ItemID

so I want to use this row by row, ...

Go to the complete details ...