有复选框情况下,sql拼写技巧

复选框选中只取合格的数据,没有选中取所有的数据。

string filterOk = (ckbOnlyOk.Checked ? " and (jyjg='合格') " : " ");//复选框选中取and (jyjg='合格'),没有选中取" "

string strSql = "select * from Student where" + filterOk + " order by name";

原文地址:https://www.cnblogs.com/net-sky/p/10063304.html