How to do addition calculation in SQL server database table column using C#

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello everyone,
I use Visual Studio 2005 and SQL server express 2005.
I need help on how to add a numerical value to an existing value in a sql server database table column and then updating the column with new value.
For instance, let us assume that the intial value of the variable contained in a database column named POINTS is 0. A VS C# application Checkedlistbox with a list of 3 items named X, Y and Z. The checkedlistbox items have the following numerical values assinged
to them: X = 3, Y = 2, Z = 4 etc.
<span style="text-decoration:underline Scenerios:
(1) If Checkedlistbox item X for instance is checked, I want 3 added to column POINTS variable value 0 and the answer i.e 3 inserted into column POINTS.
(2) If Checkedlistbox items Y and Z are checked, I want 2 + 4 i.e 6 added to column POINTS variable value 0 and the answer i.e 6 inserted into column POINTS.

I am able to do all the database, stored procedure and connection between VS and SQL. All I required is code to perform the above.
Thank you all in anticipation.


View the full article
 
Back
Top