01.
public
void
ManageStoge(
string
OrderID,
string
conStr )
02.
{
03.
SqlConnection con =
new
SqlConnection();
04.
con.ConnectionString = conStr;
05.
con.Open();
06.
string
strCom =
"SELECT * FROM orderdetails WHERE ORDER_ID = '"
+OrderID+
"'"
;
07.
SqlCommand command =
new
SqlCommand(strCom,con);
08.
SqlDataReader reader = command.ExecuteReader();
09.
while
(reader.Read())
10.
{
11.
string
strCom =
"UPDATE product SET STOCK = STOCK - '"
+reader[
"Num"
].ToString()+
"' WHERE PRODUCT_ID = '"
+reader[
"PRODUCT_ID"
].ToString()+
"'"
;
12.
SqlCommand command =
new
SqlCommand(strCom,con);
13.
command.ExecuteNonQuery();
14.
}
15.
con.Close();
16.
}