需要帮助更新数据库中的值 [英] Need help in updating value in database

查看:73
本文介绍了需要帮助更新数据库中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



以下是我从数据库中获取数据的代码



Hi all

below is my code of fetching data from database

npgcommand = new NpgsqlCommand("Select * from tbl_trans where accnumber= (select account_number from tbl_acccountdetails where holder_name='" + label3.Text + "') and printed=1", npgconn);
                npgDA = new NpgsqlDataAdapter(npgcommand);

                npgDA.Fill(dt);





现在我打印此值后。



现在我想在数据库中更新打印= 0.意味着什么行进来 dt

i想要只更新那些值。



请告诉我怎么做。



now after this i am printing this values.

now after this i want to update printed=0 in database.means what ever rows are coming in dt
i want to update only those values.

Please tell me how to do this.

推荐答案

你可以使用查询如下并执行它。





u can use query like below and execute it.


update  tbl_trans  set printed=0 where holder_name='" + label3.Text + "' and printed=1;





在填充数据表后调用此查询。



希望这会有所帮助。



call this query after your datatable is filled.

hope this helps.


这篇关于需要帮助更新数据库中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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