Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I would like to increment the existing value in column 'listed' by 1. I use the following code but it is not getting incremented. The existing value is 0.

SQL
string updateSql2 = "UPDATE district " + "SET listed =listed + 1 WHERE  dist_code = '" + v_dist_code1 + "'";
SqlCommand UpdateCmd2 = new SqlCommand(updateSql2, con);
UpdateCmd2.ExecuteNonQuery();


It is not throwing any exception or error.
Can anyone guoide me?
Posted

1 solution

C#
string updateSql2 = "UPDATE district SET listed =listed + 1 WHERE  dist_code = '" + v_dist_code1 + "'";
SqlCommand UpdateCmd2 = new SqlCommand(updateSql2, con);
UpdateCmd2.ExecuteNonQuery();

Regards..:laugh:
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900