就是有ABC三个条件,其中有可能是其中1个查询,有可能是任意两个查询,因为牵涉到要加and的问题,怎么样才能灵活的加呢,

解决方案 »

  1.   


    var
      s:string;
    begin
      s := 'where id > 1 ';
      if CheckBox1.Checked then
        s := ' and ' + s +'......';
      if CheckBox2.Checked then
        s := ' and ' + s +'......';
      if CheckBox3.Checked then
        s := ' and ' + s +'......';
    end;
      

  2.   

     s := 'where id > 1 ';
      if CheckBox1.Checked then
        s := ' and ' + s +'......';
      if CheckBox2.Checked then
        s := ' and ' + s +'......';
      if CheckBox3.Checked then
        s := ' and ' + s +'......';我这里没ID这列,就三个条件中选,呵呵如果有id可能也好办的