更新datagridview值更新时间的查询问题 [英] Update query problem for datagridview values updating time

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

问题描述

Any one please give me some ideas update query
SqlCommand cmd2 = new SqlCommand("update sales set  empnames=@empnames+'" + comboBox1.Text +"',categories=@categories, weight=@weight,per=@per,wastage=@wastage,customer=@customer,party=@party,amtcst=@amtcst,amtparty=@amtparty,amtfinal=@amtfinal where date=@date", con2);
In the above query empnames add 2 times in database it meas 
EX : 
Empnames column : ramram, I want stored single name only. Give me some ideas.





我尝试过:



更新datagridview值的查询问题更新时间



What I have tried:

Update query problem for datagridview values updating time

推荐答案

猜测 - 因为你似乎不想提供所有的实际信息它可以是 - 你的组合框包含empname,而@empnames参数也包含它。或者@empnames参数包含两次。



我们无法分辨,因为我们无法读取您的代码,或者看到除了您输入内容之外的任何其他内容。

所以使用调试器,查看您发送给SQL的确切数据,它显而易见。我们不能为你做那个...



但是不要这样做。如果您了解参数化查询,那么为什么不在整个过程中使用它们,而不是通过串联字符串来冒险使用SQL注入?
At a guess - and since you don't seem to want to provide actual information that's all it can be - your combobox contains the empname, and the @empnames parameter contains it as well. Or the @empnames parameter contains it twice.

We can't tell, because we can't read your code, or see anything other than exactly what you type.
So use the debugger, look at the exact data you are sending to SQL and it shoudl be obvious. We can't do that for you...

But don't do that. If you are aware of parameterised queries, then why are you not using them throughout, instead of risking SQL Injection by concatenating strings?


这篇关于更新datagridview值更新时间的查询问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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