List<TBL_A>list =db.TBL_A.Select(a=>a).ToList();
if(!string.IsNullOrEmpty(Request["name"]))
{
list=list.where(a=>a.Name==Request["name"]).ToList();
}
if(!string.IsNullOrEmpty(Request["age"]))
{
list=list.where(a=>a.Age==Convert.ToInt32(Request["age"])).ToList();
}
这样做,是先把所有取出来,然后进行筛选,影响效率,怎么做能把查询条件都做好,然后按条件去查询