我如何使用更新查询就像选择查询一样 [英] how i use update query same like select query

查看:82
本文介绍了我如何使用更新查询就像选择查询一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

comm.CommandText = "SELECT sponcorid from Registration_Master WHERE regCode='" + temp + "'AND count_mem=" + count_mem + "";
comm.CommandType = CommandType.Text;
comm.ExecuteNonQuery();



我想更新sponcorid我如何使用它
这是更新查询..



and i want to update sponcorid how i use it
here is update query..

comm.CommandText = "Update Registration_Master SET regCode='" + temp + "'AND count_mem=" + count_mem + "";


但是我应该在什么情况下写什么? 如果sponcor可用于注册代码(regCode),则应更新该regCode的sponcorid计数器(count_mem)


but what should i write in WHERE condition???
if sponcor is available for registration code(regCode) then sponcorid counter(count_mem) of that regCode should be updated

推荐答案

comm.CommandText = string.Format("Update Registration set Regcode={0}, count_mem={1} where sponcorid={2}", temp, count_mem, sponcor_id);



在此查询中,您可以设置所涉及的sponcorid的值.



In this query yout set the values for the sponcorid involved.


这篇关于我如何使用更新查询就像选择查询一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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