sql - Query for sum of column values not giving me a value -
i have gridview in asp page user can change 1 of values , other read value. want when row updated query execute sums value of 1 column other , changes it. ex... value1 + value 2 = value2. wrote in code-behind:
protected sub gridview1_rowupdated(sender object, e eventargs) handles gridview1.rowupdated dim connectionstring string = "mystring" using cn new sqlconnection(connectionstring) dim cmd new sqlcommand() cmd = new sqlcommand("select (purchased + actual) actual product", cn) cn.open() cmd.executenonquery() cn.close() end using yet value doesn't sum. part of me says need update command save value or read in w3 , other places doesn't point me that. guess since there's different products (of course) need productid = @parameter... right? still code should change rest of values , doesn't. pointers or flew on me? bunch!
looks want
update product set value2 = value1 + value2 productid = @parameter
Comments
Post a Comment