MXS&Vincene ─╄OvЁ &0000019─╄OvЁ MXS&Vincene
MXS&Vincene ─╄OvЁ:今天很残酷,明天更残酷,后天很美好,但是绝大部分人是死在明天晚上,只有那些真正的英雄才能见到后天的太阳。
MXS&Vincene ─╄OvЁ:We're here to put a dent in the universe. Otherwise why else even be here?
正文>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
////linq 拼接字符串 and 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,只有到此处才会执行 } ////linq 拼接字符串 or public void Test(string a,string b,string c,string d) { QueryContext query = new QueryContext(); var q1 = from u in query.Users where u.name== a && a != "" || u.age == b && b != "" || u.sex == c && c != "" || u.address ==d && d !="" select u; q1.ToList(); }