如何增加列的现有值(int) [英] How to increment the existing value of a column(int)

查看:96
本文介绍了如何增加列的现有值(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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆