8,494
社区成员




var search =
from info in context
where (txtName == "" || info.name == null || info.Sname.Contains(txtName)) //模糊查询
&&(info.password == txtPassword) //精确查询
select info;
var search = from info in context
where info.password == txtPassword //精确查询
select info;
if(!string.IsNullOrEmpty(txtName))
{
search =search .Where(s=>s.Sname.Contains(txtName));
}