以下语句报错: 这是51行  if   ADOTable1.Filter:=null then
           MessageDlg('Welcome to my Delphi application.  Exit now?',
    mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes  ;      ADOTable1.Filtered:=true;在delphi 7 中的报错信息为:[Error] Unit1.pas(51): Type of expression must be BOOLEAN
[Error] Unit1.pas(53): Too many actual parameters
[Error] Unit1.pas(55): Missing operator or semicolon
[Fatal Error] Project1.dpr(6): Could not compile used unit 'Unit1.pas'

解决方案 »

  1.   

    ADOTable1.Filter是string类型,比较:
    if ADOTable1.Filter = '' then
      ......
      

  2.   

    你的代码应该这样写:if (ADOTable1.Filter <> '') and
       (MessageDlg('Welcome to my Delphi application.  Exit now?',
        mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes) then      ADOTable1.Filtered := true;
      

  3.   

    if   ADOTable1.Filter='' then
               MessageDlg( 'Welcome to my Delphi application.  Exit now?',
        mtConfirmation, [mbYes, mbNo], 0);
      

  4.   

    if (ADOTable1.Filter = '') and
        (MessageDlg('Welcome to my Delphi application.  Exit now?',
        mtConfirmation, [mbYes, mbNo], 0) = mrYes )then
      

  5.   

    程序经修改之后
      
    if   ADOTable1.Filter = ' ' then
               MessageDlg('Welcome to my Delphi application.Exit now?',
               mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes  ;      ADOTable1.Filtered:=true;end;现在报错: 为以下,Build
      [Error] Unit1.pas(53): Too many actual parameters
      [Fatal Error] Project1.dpr(6): Could not compile used unit 'Unit1.pas'MessageDlg  这个语句有什么不对的地方?
      

  6.   

    procedure TFrmPMLR.Button2Click(Sender: TObject);
     var
    NewString: string;
    begin
         InputQuery('输入过滤条件','过滤品名为   ', NewString);
          ADOTable1.Filter:='PM like '+''''+'%'+NewString+'%'+'''';          if   ADOTable1.Filter = '' then
               MessageDlg('Welcome to my Delphi application.Exit now?',
               mtConfirmation, [mbYes, mbNo], 0)
              else      ADOTable1.Filtered := trueend;运行时,要在对话框中输入品名,就可以查出我想要的查找的品名;
    若什么也不输,会报错:Project project.exe raised exception class eoleexception with message  ‘  参数类型不正确,或不在可以接受的范围之内,或与其它参数冲突。‘ .  process stopped . use step or run to continue . 不知是什么原因?
      

  7.   

    问题在这里
    MessageDlg('Welcome to my Delphi application. Exit now?',
    mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes ;改为
    if MessageDlg('Welcome to my Delphi application. Exit now?',
    mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes  then
      

  8.   


    filtered:=false;
    filter:='id=12';
    filtered:=true;