Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL server update double datatype

Author  Topic 

daniel50096230
Yak Posting Veteran

99 Posts

Posted - 2009-10-18 : 22:50:11
i had the following sql:

Cost = Cost + Convert.ToDouble(dsPODetails.Tables(0).Rows(0).Item("Cost").ToString())
Qty1 = Qty1 + Convert.ToDouble(dsPODetails.Tables(0).Rows(0).Item("Qty").ToString())
sql = "UPDATE Trn_BranchReportTop SET Total += " + Cost + ",Qty = Qty + Qty1 WHERE SellerID='" + Session.Item("UserCompanyID") + "' AND BranchGLN='" + BranchGLN + "'"
objDB.ExecuteNonQuery(sql)


I would like to update the Total = Total + Cost,how can I modify my sql in order to perform the addition?

malaytech2008
Yak Posting Veteran

95 Posts

Posted - 2009-10-19 : 02:37:22
Hope this will help you..

Cost = Cost + Convert.ToDouble(dsPODetails.Tables(0).Rows(0).Item("Cost").ToString())

Qty1 = Qty1 + Convert.ToDouble(dsPODetails.Tables(0).Rows(0).Item("Qty").ToString())

sql = "UPDATE Trn_BranchReportTop SET Total =Total '" + Cost + "',Qty = Qty '"+ Qty1+"'
WHERE SellerID='" + Session.Item("UserCompanyID") + "' AND BranchGLN='" + BranchGLN + "'"

objDB.ExecuteNonQuery(sql)


Malay
Go to Top of Page
   

- Advertisement -