C#程序——多条件查询

string sql = "select * from Individual_Grade_Base where 1=1";
if(TextBox1.Text.Trim() != "")
{
sql = sql + " and name = '" +TextBox1.Text + "' ";
}
if(TextBox2.Text.Trim() != "")
{
sql = sql + " and name = '" +TextBox2.Text + "' ";
}

posted on 2018-02-26 17:16  topmount  阅读(464)  评论(0编辑  收藏  举报