大概这样写 string sql="select * from aaa where" if(combobox1.selectindex>=0) { sql+=" dd='"+combobox1.text+"'"; } if(combobox2.selectindex>=0) { sql+=" dd='"+combobox2.text+"'"; }