本文介绍了如何增加列的现有值(int)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将''列'列中的现有值增加1.我使用以下代码,但它没有增加。现有值为0.



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.

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?

推荐答案

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



问候......:笑:


Regards..:laugh:


这篇关于如何增加列的现有值(int)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 23:48