如何从数据库中填充条件组合框 [英] How to fill by condtion combobox from database
本文介绍了如何从数据库中填充条件组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想显示组合框中不包含"finish"的数据库中的数据
数据库中的任何记录都包含完成",我想将他从列表中隐藏
我尝试过的事情:
i want to show data from database that doesnt contain "finish" in combobox
any record in database contain "finish" i want to hide him from list
What I have tried:
string chkeii="finish";
private void comboBox1_DisplayMemberChanged(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=NAWAF;Initial Catalog=waterreport;Integrated Security=True");
con.Open();
string looad = " select no from reportone WHERE checkk=@cheioi";
SqlCommand orugg = new SqlCommand(looad, con);
orugg.Parameters.AddWithValue("@cheioi", chkeii);
con.Close();
}
推荐答案
您是正确的,但是将操作员从=
转换为<>
You are currect But chenge the opertor from=
to<>
string chkeii="finish";
private void comboBox1_DisplayMemberChanged(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=NAWAF;Initial Catalog=waterreport;Integrated Security=True");
con.Open();
string looad = " select no from reportone WHERE checkk<>@cheioi";
SqlCommand orugg = new SqlCommand(looad, con);
orugg.Parameters.AddWithValue("@cheioi", chkeii);
con.Close();
}
这篇关于如何从数据库中填充条件组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文