EF中Linq语句多个查询条件的情况

http://blog.csdn.net/q107770540/article/details/5724013

public string GetStudata()
{
string name = Request.QueryString["name"];
string sex = Request.QueryString["sex"];
string qurstr = "";
var stus = from p in data.Student
select p;
if (!string.IsNullOrEmpty(name) && sex != "Choose..." && sex != null)
{
stus = stus.Where(q=>q.name.Contains(name)&&q.sex==sex);
}
if (string.IsNullOrEmpty(name) && sex != "Choose..." && sex != null)
{
stus = stus.Where(q => q.sex == sex);
}
if (!string.IsNullOrEmpty(name) && sex == "Choose..." && sex!=null)
{
stus = stus.Where(q => q.name.Contains(name));
}