为什么查询时总是点击查询按钮两次才会有结果,而以后只要点击一次就可以有查询结果了? Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiDB/html/delphi_20061219170657216.html
我用Delphi做查询时,用的是TADOQuery,传递参数进行查询,可是,查询窗体刚打开时,为什么总是要点击“查询”两次才出结果,而以后击“查询”一次就可以显示结果了?  
   
   
  以下是代码,请高手们帮我分析一下,到底是怎么回事了,该怎么改掉这个错误!  
   
   
  //执行查询  
  procedure   TfrmBookFeeQuery.BitBtn2Click(Sender:   TObject);  
  begin                                   //执行查询  
      with   QueryDS   do  
      begin  
          close;  
          Parameters.Clear;  
          Parameters.CreateParameter('@V',ftstring,pdinput,20,Combobox1.Text);  
          if   RadioButton1.Checked   then  
                begin  
                    CommandText:='select   *   from   FeeHistory   where   [ClassName]=:V';  
                end  
          else  
                begin  
                    CommandText:='select   *   from   Departments   where   [DepartmentName]=:v';  
                end;  
   
          active:=true;  
   
      end;  
  end;

Open一下

open了也不行呀,还是一样

好明显TADOQuery是没有CommandText的,不提示你错误?

UP,我也遇到过

QueryDs是一个TADODataSet组件

相关文章:

  • 2021-10-20
  • 2022-12-23
  • 2021-12-09
  • 2022-01-08
  • 2021-09-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-05
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2021-04-20
  • 2021-05-21
  • 2022-12-23
相关资源
相似解决方案