想实现这样一个条件。
从页面TextBox接受多个条件 随着输入条件的增多 选择显示范围越来越小
改怎么写?
用 select * from table_name where 条件 and 条件 肯定不行啊 还有个问题  条件里 日期比较的格式 怎么写?是orcale的

解决方案 »

  1.   

    string strWhere = string.Empty;
    if (textBox1.Text.Tirim() > 0)
      strWhere += " and " + 条件1;
    if (textBoxN.Text.Tirim() > 0)
      strWhere +=" and " + 条件N;
    if (strWhere.Trim() > 0)
       strWhere = " Where" + strWhere.Remove(0,4);
    string StrSql +=StrWhere;
    日期比较:
    to_char(日期字段,'yyyy-MM-dd') = '日期条件'
      

  2.   

    if (textBox1.Text.Tirim() > 0)
    ====
    if (textBox1.Text.Tirim()!="")
      

  3.   

    if (textBox1.Text.Tirim().Length() > 0)
    笔误 :)