你写利用if或者case的判断语句吧!/*************************************/
/*1、为了五星的目标希望你早点结贴    */
/*2、在看球赛时坚决支持中国队对手    */
/*4、在国际纠纷上坚决支持中国        */
/*************************************/

解决方案 »

  1.   

    你的checkbox,edit是什么关系,是由checkbox决定edit的活动性,还是都是平行的。这方面的代码我写过,但你要说清楚。
      

  2.   

    是checkbox决定edit的活动性,然后执行sql查询
      

  3.   

    关键是第一个条件前面不加And或者or,这个控制应该不太难的。with qryCatchBug do
    begin
      if Active then
        Close;
      SQL.Clear;
      SQL.Add('select * from bugs');  bIsFirstCondition:=True;  if cbLegNum.Checked then
      begin
        if bIsFirstCondition then
        begin
          SQL.Add('where LegNum=:LegNum');
          bIsFirstCondition:=False;
        end
        else begin
          SQL.Add('and LegNum=:LegNum');
        end;    {something like above }
        ........
        ParamByName('LegNum').AsInteger:=StrToInt(edtLegNum.Text);    
        ....    try
         Open;
        except
         Close; 
        end;
        
        {Now You Got the Bugs!Congratulations!}
      end;
    end;
      

  4.   

    不好意思,好象这段程序就有个Bug,如果cbLegNum.Checked = False那么
    ParamByName('LegNum').AsInteger:=StrToInt(edtLegNum.Text);会出错呀。
    呵呵,不好意思,不过改动很少拉。当然,StrToInt(edtLegNum.Text)也可能出异常的,要做有效性判断哦!!
      

  5.   

    with qryCatchBug do
    begin
      if Active then
        Close;
      SQL.Clear;
      SQL.Add('select * from bugs');  bIsFirstCondition:=True;  if cbLegNum.Checked then
      begin
        if bIsFirstCondition then
        begin
          SQL.Add('where LegNum=:LegNum');
          bIsFirstCondition:=False;
        end
        else begin
          SQL.Add('and LegNum=:LegNum');
        end;
      end;
      {something like above }
       ........
      if cbLegNum.Checked then
        ParamByName('LegNum').AsInteger:=StrToInt(edtLegNum.Text);    
      ....  try
        Open;
      except
        Close; 
      end;
        
      {Now You Got the Bugs!Congratulations!}
    end;
      

  6.   

    请问bIsFirstCondition是什么参数