sql 组合条件查询?
c# mysql winfroms
需要判断100个查询条件
string str = " select * from clinMater where 1=1 ";
if (comboBox1.Text.Trim() != "")
{
str += "and M2" + " = '" + comboBox1.Text + "'";
}
if (comboBox2.Text.Trim() != "")
{
str += "and M3" + " = '" + comboBox2.Text + "'";
}
。。。。。。。。。
以下判断100个查询条件,如果100个and条件都成立,sql语句能执行吗?
有没有简便效率的方法?