如何通过检查组合框中的值来删除行 [英] how to delete the row by checking values in combo box
本文介绍了如何通过检查组合框中的值来删除行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用组合框。当我选择组合框时我想用数据库comloum检查值是否匹配然后删除行
i use the combo box. when i select the combo box i want to check the values with the database comloum if match then delete the rows
推荐答案
button_Click(object sender, EventArgs e)
{
string str = "DELETE FROM Employee WHERE EmpID = '" + int.parse(EmpIDComboBox.SelectedValue.ToString()) + "'";
SqlCommand cmd = new SqlCommand(str, con); // con is you SqlConnection instance
int n = cmd.ExecuteNonQuery();
if(n > 0)
MessageBox.Show("Employee removed !");
}
-KR
-KR
这篇关于如何通过检查组合框中的值来删除行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文