link中如何根据checkbox的值在多个属性中模糊查询?
参考: http://blog.csdn.net/q107770540/article/details/5724013
public void Test(string a, string b, string c,string d)
{
QueryContext query = new QueryContext();
var q = from u in query.Users
select u;
if (!string.IsNullOrEmpty(a))
{
q = q.Where(p => p.name == a);
}
if (!string.IsNullOrEmpty(b))
{
q = q.Where(p => p.age == b);
}
if (!string.IsNullOrEmpty(c))
{
q = q.Where(p => p.sex == c);
}
if (!string.IsNullOrEmpty(d))
{
q = q.Where(p => p.address == d);
}
q.ToList(); //上边的所有if,只有到此处才会执行
}
获得的属性不是有getvalue吗,得到值,然后去判断
根据checkbox判断,然后拼接构造查询,google下。
你的问题提的不怎么清楚,即没有说明用什么开发工具,也没说明false和true分别对应的什么,但大致如下即可:
((CheckBox1->Checked == true) ? "√" : "×") // √和×换成你自己的
和你的SQL语句连接起来就可以了