我想在文本框中输入代表值的数据我在Sql查询中感到困惑吗? [英] I Want To Delete Data On Behalf Of Value Enter In Textbox I Am Stiill Confused In Sql Query?
本文介绍了我想在文本框中输入代表值的数据我在Sql查询中感到困惑吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
delete firstname, last name from emp where id = "" + textbox.text + ""
这是对还是不正确?
this is correct or not?
推荐答案
如果您最大的问题是SQL语法,我建议您阅读一些教程。
网上有很多。
这只是一个例子: SQL Tutorial [ ^ ]
特别针对您的情况: SQL DELETE语句 [ ^ ]
(Th只是对彼得解决方案1的补充。)
If your biggest problem is the SQL syntax, I recommend to read some tutorials.
There are plenty of them online.
This is just one example: SQL Tutorial[^]
Specifically for your case: SQL DELETE Statement[^]
(This is merely a complement to Peter's solution 1.)
你用过
删除名字,来自emp的姓氏,其中id =+ textbox.text +
在这里你可以使用
从emp中删除id =+ textbox.Text +
如果Id是数据库中的int则使用代码
you have used
delete firstname, last name from emp where id = "" + textbox.text + ""
here you can use
delete from emp where id = "" + textbox.Text + ""
if Id is int in database then use code
string idValue=textbox.Text.Trim();
if(!string.IsNullOrWhiteSpace(idValue))
{
int outvalue;
var id=int.TryParse(idValue)?outvalue:0;
delete from emp where id = "" + idValue+ ""
}
如果你只想删除FirstName和LastName然后改变该行并使该列为null,
If you just want to delete FirstName and LastName then alter that row and make that columns null like,
Update emp SET FirstName = ' ', lastName = ' ' where id = "" + textbox.text + ""
这篇关于我想在文本框中输入代表值的数据我在Sql查询中感到困惑吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文