Home > Net >  Would like to ask how the SQL statement for the sum of product of two columns
Would like to ask how the SQL statement for the sum of product of two columns

Time:09-19

 
Public bool the AddOrder (Order newOrder)
{
String sqlStr="insert into T_Order (OrderID, OrderTime, OrderTotal) VALUES (@ RandomID @ Time, @ Money); Insert into T_OrderGoods (OrderID, GoodsID, GoodsMoney, GoodsName, GoodsNumber) VALUES (@ RandomID, @ Id, @ Money, @ Name, @ Number) ";

SqlParameter param []=new SqlParameter []
{
New SqlParameter (" @ Id, "newOrder. Product Id),
New SqlParameter (" @ Number, "newOrder. Product Number),
New SqlParameter (" @ Money, "newOrder. Products unit price),
New SqlParameter (" @ the Name, "newOrder. Product Name),
New SqlParameter (" @ the Time, "newOrder. Order of Time),
New SqlParameter (" @ RandomID, "newOrder. Order ID),
};

Return DBHelper. ExcuteCommand (sqlStr, param);
}




figure I wrote above the execution of the SQL statement OrderTotal=total amount order @ the unit price of items money can only be deposited in a
Could you tell me how to write to get to the unit price and x number field, inserted in the total amount of?

CodePudding user response:

Insert into T_Order (OrderID, OrderTime, OrderTotal) VALUES (@ RandomID @ Time, @ Money * @ Number);
  • Related