if (edtDh.Text = '') or (edtParcel.Text = '') then
          begin
            Application.MessageBox('请输入您要查询的街道或幢号', '', mb_ok +
              mb_IconInformation);
            if (edtDh.Text = '') then
              edtDh.SetFocus
            else
              edtParcel.SetFocus;
            Abort;
          end
          else
          begin
            //SeekPq(Trim(edtParcel.Text));
            str := Trim(edtparcel.Text );
            str2 := Trim(edtdh.Text);
            ADOTPianqu.Close;
            ADOTPianqu.Filter:='jd=''' + str +'''';
            ADOTPianqu.Filtered :=true;
            ADOTPianqu.Open;
            if ADOTPianqu.RecordCount=1 then
            begin
             strGrid1:=strGrid1+Trim(IntToStr(adotpianqu.fieldbyname('pqid').AsInteger));
            end
            else
            while Not (ADOTPianqu.eof) do
            begin
             i:=i+1;
             strGrid1:=strGrid1+Trim(IntToStr(adotpianqu.fieldbyname('pqid').AsInteger) );
             ADOTPianqu.Next;
             if (i<>ADOTPianqu.RecordCount) then
             strGrid1:=strGrid1+''' or pqid=''';
           end;
           ADTDbInfManage.Close;
           ADTDbInfManage.Filter := 'pqid like ''' + strgrid1 + ''' and dh=''' + str2 +
              '''';当记录中有二条以上时系统会报参数不配备和类型不对,请问各位前辈这是怎么回事?
           ADTDbInfManage.Filtered := True;
           ADTDbInfManage.Open;
          end;

解决方案 »

  1.   

    if (edtDh.Text = '') or (edtParcel.Text = '') then
              begin
                Application.MessageBox('请输入您要查询的街道或幢号', '', mb_ok +
                  mb_IconInformation);
                if (edtDh.Text = '') then
                  edtDh.SetFocus
                else
                  edtParcel.SetFocus;
                Abort;
              end
              else
              begin
                //SeekPq(Trim(edtParcel.Text));
                str := Trim(edtparcel.Text );
                str2 := Trim(edtdh.Text);
                ADOTPianqu.Close;
                ADOTPianqu.Filter:='jd=''' + str +'''';
                ADOTPianqu.Filtered :=true;
                ADOTPianqu.Open;
                if ADOTPianqu.RecordCount=1 then
                begin
                 strGrid1:=strGrid1+Trim(IntToStr(adotpianqu.fieldbyname('pqid').AsInteger));
                end
                else
                while Not (ADOTPianqu.eof) do
                begin
                 i:=i+1;
                 strGrid1:=strGrid1+Trim(IntToStr(adotpianqu.fieldbyname('pqid').AsInteger) );
                 ADOTPianqu.Next;
                 if (i<>ADOTPianqu.RecordCount) then  //I think problem is here, this will be runned many times until ADOTPianqu become to eof, so strGrid1 will be error in Filtered. 
                 strGrid1:=strGrid1+''' or pqid=''';
               end;
               //if (i<>ADOTPianqu.RecordCount) then  //change in here i think.
               //strGrid1:=strGrid1+''' or pqid=''';           ADTDbInfManage.Close;
               ADTDbInfManage.Filter := 'pqid like ''' + strgrid1 + ''' and dh=''' + str2 +
                  '''';当记录中有二条以上时系统会报参数不配备和类型不对,请问各位前辈这是怎么回事?
               ADTDbInfManage.Filtered := True;
               ADTDbInfManage.Open;
              end;