假设有两个Textbox,分别为textbox1和textbox2,有个表,表名为list,里面有x列和y列var a=from b in list where b.x==textbox1.Text.Trim()||string.IsNullOrEmpty(textbox1.Text.Trim()) &&(b.y==textbox2.Text.Trim()||string.IsNullOrEmpty(textbox1.Text.Trim())) select b;