procedure TForm15.Button4Click(Sender: TObject);
var
  str : string;
  str1 : string;
  str2 : string;
  str3 : string;  i : integer;
  j : integer;
  k : integer;
  l : integer;
begin
  i := 6;
  str := Form27.ADOQuery1.SQL[2];  if Edit1.Text <> '' then
  begin
    str1 := ' or 车牌号 = ""';
    insert(Edit1.Text ,str1,15);
    Insert(str1,str,i);
    i := Length(str1) + i ;  end;
    if edit2.Text <> '' then
    begin
      str1 := ' or 车牌号 = ""';
      insert(Edit2.Text ,str1,15);
      Insert(str1,str,i);
      i := Length(str1) + i ;    end;
    if edit3.Text <> '' then
    begin
      str1 := ' or 车牌号 = ""';
      insert(Edit3.Text ,str1,15);
      Insert(str1,str,i);
      i := Length(str1) + i ;    end;
    if edit4.Text <> '' then
    begin
      str1 := ' or 车牌号 = ""';
      insert(Edit4.Text ,str1,15);
      Insert(str1,str,i);
      i := Length(str1) + i ;    end;
    if edit5.Text <> '' then
    begin
      str1 := ' or 车牌号 = ""';
      insert(Edit5.Text ,str1,15);
      Insert(str1,str,i);
      i := Length(str1) + i ;    end;
    if edit6.Text <> '' then
    begin
      str1 := ' or 车牌号 = ""';
      insert(Edit6.Text ,str1,15);
      Insert(str1,str,i);
      i := Length(str1) + i ;    end;
    if edit7.Text <> '' then
    begin
      str1 := ' or 车牌号 = ""';
      insert(Edit7.Text ,str1,15);
      Insert(str1,str,i);
      i := Length(str1) + i ;    end;
 有谁帮我解决了
我有多少分全部相送

解决方案 »

  1.   

    if edit8.Text <> '' then
        begin
          str1 := ' or 车牌号 = ""';
          insert(Edit8.Text ,str1,15);
          Insert(str1,str,i);
          i := Length(str1) + i ;    end;  if (Edit9.Text <> '') and (edit10.Text <> '') then
      begin
        try
          k := StrToInt(edit9.text);
          l := StrToInt(edit10.text);
        except
          on EConvertError do
            showMessage('您输入的不是整形数据');
        end;
        if k <= l then
        begin
          str1 := ' or 内编号 >= ';
          insert(IntToStr(k),str1,15);
          Insert(str1,str,i);
          i := Length(str1) + i ;      str1 := ' and 内编号 <= ';
          insert(IntToStr(l),str1,16);
          Insert(str1,str,i);
          i := Length(str1) + i ;
        end
        else
          MessageBox(Form15.Handle,'您输入的内编号有问题','空查询',MB_OK);  end;  if Length(str) > 6 then
      begin
        delete(str,7,2);
        Insert('(',str,7);
        Insert(')',str,i);
        i := i + 2;
        str1 := ' and 交费时间 >= ##';
        str2 := dateTostr(DateTimePicker1.date);
        Insert(str2,str1,19);
        Insert(str1,str,i);
        i := Length(str1) + i ;
        str1 := ' and 交费时间 <= ##';
        str2 := dateTostr(DateTimePicker2.date);
        Insert(str2,str1,19);
        Insert(str1,str,i);
        i := Length(str1) + i ;
      end
      else
      begin
        MessageBox(Form15.Handle,'请输入车牌号或内编号','空查询',MB_OK);
      end;  if CheckBox25.Checked  then
      begin
        CheckBox25.Checked := False;
      end;
      if CheckBox26.Checked  then
      begin
        CheckBox26.Checked := False;
      end;
      
      if CheckBox22.Checked  then
      begin
        CheckBox22.Checked := False;
      end;
      if CheckBox23.Checked  then
      begin
        CheckBox23.Checked := False;
      end;
      if CheckBox24.Checked  then
      begin
        CheckBox24.Checked := False;
      end;
      

  2.   

    if CheckBox1.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "管理费"';
        insert(str1,str3,i);
        Form27.ADOQuery1.SQL[2] := str3;
        Form27.ADOQuery1.Active := True;  end;
      if CheckBox4.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "技术评定"';
        insert(str1,str3,i);
        Form27.ADOQuery2.SQL[2] := str3;
        Form27.ADOQuery2.Active := True;  end;
      if CheckBox5.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "二级维护"';
        insert(str1,str3,i);
        Form27.ADOQuery3.SQL[2] := str3;
        Form27.ADOQuery3.Active := True;  end;
      if CheckBox10.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "养路费"';
        insert(str1,str3,i);
        Form27.ADOQuery4.SQL[2] := str3;
        Form27.ADOQuery4.Active := True;  end;
      if CheckBox2.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "交通规费"';
        insert(str1,str3,i);
        Form27.ADOQuery5.SQL[2] := str3;
        Form27.ADOQuery5.Active := True;  end;
      if CheckBox3.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "工商"';
        insert(str1,str3,i);
        Form27.ADOQuery6.SQL[2] := str3;
        Form27.ADOQuery6.Active := True;  end;
      if CheckBox6.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "保险"';
        insert(str1,str3,i);
        Form27.ADOQuery7.SQL[2] := str3;
        Form27.ADOQuery7.Active := True;  end;
      if CheckBox13.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "代收税费"';
        insert(str1,str3,i);
        Form27.ADOQuery8.SQL[2] := str3;
        Form27.ADOQuery8.Active := True;  end;
      if CheckBox14.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "路单押金"';
        insert(str1,str3,i);
        Form27.ADOQuery9.SQL[2] := str3;
        Form27.ADOQuery9.Active := True;  end;
      

  3.   

    if CheckBox15.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "路单"';
        insert(str1,str3,i);
        Form27.ADOQuery10.SQL[2] := str3;
        Form27.ADOQuery10.Active := True;  end;
      if CheckBox9.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "交易费"';
        insert(str1,str3,i);
        Form27.ADOQuery11.SQL[2] := str3;
        Form27.ADOQuery11.Active := True;  end;
      if CheckBox7.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "保证金"';
        insert(str1,str3,i);
        Form27.ADOQuery12.SQL[2] := str3;
        Form27.ADOQuery12.Active := True;  end;
      if CheckBox8.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "互助金"';
        insert(str1,str3,i);
        Form27.ADOQuery13.SQL[2] := str3;
        Form27.ADOQuery13.Active := True;  end;
      if CheckBox16.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "行车证审验费"';
        insert(str1,str3,i);
        Form27.ADOQuery14.SQL[2] := str3;
        Form27.ADOQuery14.Active := True;  end;
      if CheckBox17.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "营运证审验费"';
        insert(str1,str3,i);
        Form27.ADOQuery15.SQL[2] := str3;
        Form27.ADOQuery15.Active := True;  end;
      if CheckBox18.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "驾驶证审验费"';
        insert(str1,str3,i);
        Form27.ADOQuery16.SQL[2] := str3;
        Form27.ADOQuery16.Active := True;  end;
      if CheckBox19.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "从业证审验费"';
        insert(str1,str3,i);
        Form27.ADOQuery17.SQL[2] := str3;
        Form27.ADOQuery17.Active := True;  end;
      if CheckBox11.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "其他1"';
        insert(str1,str3,i);
        Form27.ADOQuery18.SQL[2] := str3;
        Form27.ADOQuery18.Active := True;  end;
      if CheckBox12.Checked and (Length(str) > 6) then
      begin
        str3 := str;
        str1 := ' and 项目 = "其他2"';
        insert(str1,str3,i);
        Form27.ADOQuery19.SQL[2] := str3;
        Form27.ADOQuery19.Active := True;  end;
      if Length(str) > 6 then
      begin
        if CheckBox1.Checked or CheckBox4.Checked or CheckBox5.Checked or
           CheckBox10.Checked or CheckBox2.Checked or CheckBox3.Checked or
           CheckBox6.Checked or CheckBox13.Checked or CheckBox14.Checked or
           CheckBox15.Checked or CheckBox9.Checked or CheckBox7.Checked or
           CheckBox8.Checked or CheckBox16.Checked or CheckBox17.Checked or
           CheckBox18.Checked or CheckBox19.Checked or CheckBox11.Checked or
           CheckBox12.Checked then
        begin
          Form27.Show ;
          CheckBox1.Checked := False;
          CheckBox4.Checked := False;
          CheckBox5.Checked := False;
          CheckBox10.Checked := False;
          CheckBox2.Checked := False;
          CheckBox3.Checked := False;
          CheckBox6.Checked := False;
          CheckBox13.Checked := False;
          CheckBox14.Checked := False;
          CheckBox15.Checked := False;
          CheckBox9.Checked := False;
          CheckBox7.Checked := False;
          CheckBox8.Checked := False;
          CheckBox16.Checked := False;
          CheckBox17.Checked := False;
          CheckBox18.Checked := False;
          CheckBox19.Checked := False;
          CheckBox11.Checked := False;
          CheckBox12.Checked := False;
          Edit1.Text := '';
          edit2.Text := '';
          edit3.Text := '';
          edit4.Text := '';
          edit5.Text := '';
          edit6.Text := '';
          edit7.Text := '';
          edit8.Text := '';
        end
        else
        begin
          MessageBox(Form15.Handle,'请选择一个查询项目','空查询',MB_OK);
        end;
      end;end;
      

  4.   

    我还有一个窗口没有发上来
    当我选择多项查询的时候
    显现的'内编号' '姓名''车牌号'都是以最后一项的查询为结果的
    这是不对的
    如果帮我解决了要多少给多少
    type
      TForm27 = class(TForm)
        ADOQuery1: TADOQuery;
        Button1: TButton;
        Label1: TLabel;
        StringGrid1: TStringGrid;
        ADOQuery2: TADOQuery;
        ADOQuery3: TADOQuery;
        ADOQuery4: TADOQuery;
        ADOQuery5: TADOQuery;
        ADOQuery6: TADOQuery;
        ADOQuery7: TADOQuery;
        ADOQuery8: TADOQuery;
        ADOQuery9: TADOQuery;
        ADOQuery10: TADOQuery;
        ADOQuery11: TADOQuery;
        ADOQuery12: TADOQuery;
        ADOQuery13: TADOQuery;
        ADOQuery14: TADOQuery;
        ADOQuery15: TADOQuery;
        ADOQuery16: TADOQuery;
        ADOQuery17: TADOQuery;
        ADOQuery18: TADOQuery;
        ADOQuery19: TADOQuery;
        ADOTable1: TADOTable;
        procedure Button1Click(Sender: TObject);
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
        procedure FormCreate(Sender: TObject);
        procedure FormShow(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form27: TForm27;implementation
      uses Unit15;
    {$R *.dfm}procedure TForm27.Button1Click(Sender: TObject);
    begin
      Form27.Close ;
    end;procedure TForm27.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      ADOQuery1.SQL[2] := 'where ';
      ADOQuery2.SQL[2] := 'where ';
      ADOQuery3.SQL[2] := 'where ';
      ADOQuery4.SQL[2] := 'where ';
      ADOQuery5.SQL[2] := 'where ';
      ADOQuery6.SQL[2] := 'where ';
      ADOQuery7.SQL[2] := 'where ';
      ADOQuery8.SQL[2] := 'where ';
      ADOQuery9.SQL[2] := 'where ';
      ADOQuery10.SQL[2] := 'where ';
      ADOQuery11.SQL[2] := 'where ';
      ADOQuery12.SQL[2] := 'where ';
      ADOQuery13.SQL[2] := 'where ';
      ADOQuery14.SQL[2] := 'where ';
      ADOQuery15.SQL[2] := 'where ';
      ADOQuery16.SQL[2] := 'where ';
      ADOQuery17.SQL[2] := 'where ';
      ADOQuery18.SQL[2] := 'where ';
      ADOQuery19.SQL[2] := 'where ';
      ADOQuery1.Active := False;
      ADOQuery2.Active := False;
      ADOQuery3.Active := False;
      ADOQuery4.Active := False;
      ADOQuery5.Active := False;
      ADOQuery6.Active := False;
      ADOQuery7.Active := False;
      ADOQuery8.Active := False;
      ADOQuery9.Active := False;
      ADOQuery10.Active := False;
      ADOQuery11.Active := False;
      ADOQuery12.Active := False;
      ADOQuery13.Active := False;
      ADOQuery14.Active := False;
      ADOQuery15.Active := False;
      ADOQuery16.Active := False;
      ADOQuery17.Active := False;
      ADOQuery18.Active := False;
      ADOQuery19.Active := False;
      ADOTable1.Active := False;
    end;procedure TForm27.FormCreate(Sender: TObject);
    begin
      ADOQuery1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery2.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery3.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery4.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery5.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery6.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery7.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery8.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery9.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery10.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery11.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery12.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery13.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery14.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery15.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery16.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery17.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery18.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOQuery19.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';  ADOTable1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
                                    + GetCurrentDir + '\sjk.aaa;' + 'Persist Security Info=False';
      ADOTable1.Active := True;
      ADOTable1.Active := False;
    end;procedure TForm27.FormShow(Sender: TObject);
    var
      str : string;
      str1 : string;
      i : integer;
      j : integer;
      k : integer;
      l : integer;
      m : integer;        //判断并控制往字符串控件中添加数据
      MyLocate : Boolean;
      SOpt : TLocateOptions;
    begin
      str := '统计日期从 ';
      str1 := Concat(str,DateToStr(Form15.DateTimePicker1.DateTime));
      str := ' 至 ';
      str1 := Concat(str1,str);
      str1 := Concat(str1,DateToStr(Form15.DateTimePicker2.DateTime));
      Label1.Caption := str1;  j := 1 ;
      i := 1;
      StringGrid1.RowCount := 1;
      if ADOQuery1.Active then
      begin
        j := j + 1 ;    ADOQuery1.First ;
        while not ADOQuery1.Eof do
        begin
          i := i + 1 ;
          ADOQuery1.Next ;
         end;
         StringGrid1.RowCount := i;
            m := 1;
      end;
      if ADOQuery2.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery2.First ;
          while not ADOQuery2.Eof do
          begin
            i := i + 1 ;
            ADOQuery2.Next ;
          end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
           end;
           m := 2;
      end;
      if ADOQuery3.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery3.First ;
          while not ADOQuery3.Eof do
          begin
            i := i + 1 ;
            ADOQuery3.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
           m := 3;
      end;
      

  5.   

    if ADOQuery4.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery4.First ;
          while not ADOQuery4.Eof do
          begin
            i := i + 1 ;
            ADOQuery4.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
            m := 4;
      end;
      if ADOQuery5.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery5.First ;
          while not ADOQuery5.Eof do
          begin
            i := i + 1 ;
            ADOQuery5.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
             m := 5;
      end;
      if ADOQuery6.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery6.First ;
          while not ADOQuery6.Eof do
          begin
            i := i + 1 ;
            ADOQuery6.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
             m := 6;
      end;
      if ADOQuery7.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery7.First ;
          while not ADOQuery7.Eof do
          begin
            i := i + 1 ;
            ADOQuery7.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
             m := 7;
      end;
      if ADOQuery8.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery8.First ;
          while not ADOQuery8.Eof do
          begin
            i := i + 1 ;
            ADOQuery8.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
             m := 8;
      end;        
      if ADOQuery9.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery9.First ;
          while not ADOQuery9.Eof do
          begin
            i := i + 1 ;
            ADOQuery9.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
             m := 9;
      end;
      if ADOQuery10.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery10.First ;
          while not ADOQuery10.Eof do
          begin
            i := i + 1 ;
            ADOQuery10.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
             m := 10;
      end;
      if ADOQuery11.Active then
      begin
        j := j + 1 ;
        i := 1;      ADOQuery11.First ;
          while not ADOQuery11.Eof do
          begin
            i := i + 1 ;
            ADOQuery11.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
            
           end;
             m := 11;
      end;
      if ADOQuery12.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery12.First ;
          while not ADOQuery12.Eof do
          begin
            i := i + 1 ;
            ADOQuery12.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
            
           end;
             m := 12;
      end;
      if ADOQuery13.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery13.First ;
          while not ADOQuery13.Eof do
          begin
            i := i + 1 ;
            ADOQuery13.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
             m := 13;
      end;
      if ADOQuery14.Active then
      begin
        j := j + 1 ;
        i := 1;      ADOQuery14.First ;
          while not ADOQuery14.Eof do
          begin
            i := i + 1 ;
            ADOQuery14.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
            m := 14;
      end;
      if ADOQuery15.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery15.First ;
          while not ADOQuery15.Eof do
          begin
            i := i + 1 ;
            ADOQuery15.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
             m := 15;
      end;
      if ADOQuery16.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery16.First ;
          while not ADOQuery16.Eof do
          begin
            i := i + 1 ;
            ADOQuery16.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
              m := 16;
      end;
      if ADOQuery17.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery17.First ;
          while not ADOQuery17.Eof do
          begin
            i := i + 1 ;
            ADOQuery17.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
             m := 17;
      end;
      if ADOQuery18.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery18.First ;
          while not ADOQuery18.Eof do
          begin
            i := i + 1 ;
            ADOQuery18.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
              m := 18;
      end;
      if ADOQuery19.Active then
      begin
        j := j + 1 ;
        i := 1;
          ADOQuery19.First ;
          while not ADOQuery19.Eof do
          begin
            i := i + 1 ;
            ADOQuery19.Next ;
           end;
           if i > StringGrid1.RowCount then
           begin
             StringGrid1.RowCount := i;
             
           end;
              m := 19;
      end;
      StringGrid1.ColCount := j + 2 ;  StringGrid1.ColWidths[0] := 60;
      StringGrid1.Width := 80 * j + 20 ;
      if StringGrid1.Width < 865 then
        StringGrid1.Width := 865;
      StringGrid1.Height := (StringGrid1.RowCount + 3) * 17 ;
      if StringGrid1.Height < 513 then
        StringGrid1.Height := 513;
      Button1.Top := StringGrid1.Height + 45;  StringGrid1.Cells[0,0] := '车牌号';
      i := StringGrid1.RowCount - 2;
      if ADOQuery1.Active then
      begin
        ADOQuery1.First ;
        for k := 0 to i do
        begin
          if m = 1 then
            StringGrid1.Cells[0,k + 1] := ADOQuery1.Fields[0].asstring;
          ADOQuery1.Next ;
        end;
      end;
      if ADOQuery2.Active then
      begin
        ADOQuery2.First ;
        for k := 0 to i do
        begin
          if m = 2 then
            StringGrid1.Cells[0,k + 1] := ADOQuery2.Fields[0].asstring;
          ADOQuery2.Next ;
        end;
      end;
      if ADOQuery3.Active then
      begin
        ADOQuery3.First ;
        for k := 0 to i do
        begin
          if m = 3 then
            StringGrid1.Cells[0,k + 1] := ADOQuery3.Fields[0].asstring;
          ADOQuery3.Next ;
        end;
      end;
      if ADOQuery4.Active then
      begin
        ADOQuery4.First ;
        for k := 0 to i do
        begin
          if m = 4 then
            StringGrid1.Cells[0,k + 1] := ADOQuery4.Fields[0].asstring;
          ADOQuery4.Next ;
        end;
      end;
      if ADOQuery5.Active then
      begin
        ADOQuery5.First ;
        for k := 0 to i do
        begin
          if m = 5 then
            StringGrid1.Cells[0,k + 1] := ADOQuery5.Fields[0].asstring;
          ADOQuery5.Next ;
        end;
      end;
      if ADOQuery6.Active then
      begin
        ADOQuery6.First ;
        for k := 0 to i do
        begin
          if m = 6 then
            StringGrid1.Cells[0,k + 1] := ADOQuery6.Fields[0].asstring;
          ADOQuery6.Next ;
        end;
      end;
      if ADOQuery7.Active then
      begin
        ADOQuery7.First ;
        for k := 0 to i do
        begin
          if m = 7 then
            StringGrid1.Cells[0,k + 1] := ADOQuery7.Fields[0].asstring;
          ADOQuery7.Next ;
        end;
      end;
      if ADOQuery8.Active then
      begin
        ADOQuery8.First ;
        for k := 0 to i do
        begin
          if m = 8 then
            StringGrid1.Cells[0,k + 1] := ADOQuery8.Fields[0].asstring;
          ADOQuery8.Next ;
        end;
      end;
      

  6.   

    if ADOQuery9.Active then
      begin
        ADOQuery9.First ;
        for k := 0 to i do
        begin
          if m = 9 then
            StringGrid1.Cells[0,k + 1] := ADOQuery9.Fields[0].asstring;
          ADOQuery9.Next ;
        end;
      end;
      if ADOQuery10.Active then
      begin
        ADOQuery10.First ;
        for k := 0 to i do
        begin
          if m = 10 then
            StringGrid1.Cells[0,k + 1] := ADOQuery10.Fields[0].asstring;
          ADOQuery10.Next ;
        end;
      end;
      if ADOQuery11.Active then
      begin
        ADOQuery11.First ;
        for k := 0 to i do
        begin
          if m = 11 then
            StringGrid1.Cells[0,k + 1] := ADOQuery11.Fields[0].asstring;
          ADOQuery11.Next ;
        end;
      end;
      if ADOQuery12.Active then
      begin
        ADOQuery12.First ;
        for k := 0 to i do
        begin
          if m = 12 then
            StringGrid1.Cells[0,k + 1] := ADOQuery12.Fields[0].asstring;
          ADOQuery12.Next ;
        end;
      end;
      if ADOQuery13.Active then
      begin
        ADOQuery13.First ;
        for k := 0 to i do
        begin
          if m = 13 then
            StringGrid1.Cells[0,k + 1] := ADOQuery13.Fields[0].asstring;
          ADOQuery13.Next ;
        end;
      end;
      if ADOQuery14.Active then
      begin
        ADOQuery14.First ;
        for k := 0 to i do
        begin
          if m = 14 then
            StringGrid1.Cells[0,k + 1] := ADOQuery14.Fields[0].asstring;
          ADOQuery14.Next ;
        end;
      end;
      if ADOQuery15.Active then
      begin
        ADOQuery15.First ;
        for k := 0 to i do
        begin
          if m = 15 then
            StringGrid1.Cells[0,k + 1] := ADOQuery15.Fields[0].asstring;
          ADOQuery15.Next ;
        end;
      end;
      if ADOQuery16.Active then
      begin
        ADOQuery16.First ;
        for k := 0 to i do
        begin
          if m = 16 then
            StringGrid1.Cells[0,k + 1] := ADOQuery16.Fields[0].asstring;
          ADOQuery16.Next ;
        end;
      end;
      if ADOQuery17.Active then
      begin
        ADOQuery17.First ;
        for k := 0 to i do
        begin
          if m = 17 then
            StringGrid1.Cells[0,k + 1] := ADOQuery17.Fields[0].asstring;
          ADOQuery17.Next ;
        end;
      end;
      if ADOQuery18.Active then
      begin
        ADOQuery18.First ;
        for k := 0 to i do
        begin
          if m = 18 then
            StringGrid1.Cells[0,k + 1] := ADOQuery18.Fields[0].asstring;
          ADOQuery18.Next ;
        end;
      end;
      if ADOQuery19.Active then
      begin
        ADOQuery19.First ;
        for k := 0 to i do
        begin
          if m = 19 then
            StringGrid1.Cells[0,k + 1] := ADOQuery19.Fields[0].asstring;
          ADOQuery19.Next ;
        end;
      end;  if ADOTable1.Active = False then
        ADOTable1.Active := True;
      StringGrid1.Cells[1,0] := '内编号';
      StringGrid1.Cells[2,0] := '姓名';
      for k := 0 to i do
      begin
        SOpt := [loCaseInsensitive];
        ADOTable1.Locate('车牌号',StringGrid1.Cells[0,k + 1],SOpt);
        StringGrid1.Cells[1,k + 1] := ADOTable1.Fields[0].AsString ;
        StringGrid1.Cells[2,k + 1] := ADOTable1.Fields[1].AsString ;
      end;  l := 3;
      if ADOQuery1.Active then
      begin
        StringGrid1.Cells[l,0] := '管理费';
        ADOQuery1.First ;
        for k := 0 to i do
        begin
          if ADOQuery1.Fields[0].asstring = StringGrid1.Cells[0,k + 1] then
            StringGrid1.Cells[l,k + 1] := ADOQuery1.Fields[1].asstring;
          ADOQuery1.Next ;
        end;
        l := l + 1;
      end;
      if ADOQuery2.Active then
      begin
        StringGrid1.Cells[l,0] := '技术评定';
        ADOQuery2.First ;
        for k := 0 to i do
        begin
          if ADOQuery2.Fields[0].asstring = StringGrid1.Cells[0,k + 1] then
            StringGrid1.Cells[l,k + 1] := ADOQuery2.Fields[1].asstring;
          ADOQuery2.Next ;
        end;
        l := l + 1 ;
      end;
      if ADOQuery3.Active then
      begin
        StringGrid1.Cells[l,0] := '二级维护';
        ADOQuery3.First ;
        for k := 0 to i do
        begin
          if ADOQuery3.Fields[0].asstring = StringGrid1.Cells[0,k + 1] then
            StringGrid1.Cells[l,k + 1] := ADOQuery3.Fields[1].asstring;
          ADOQuery3.Next ;
        end;
        l := l + 1 ;
      end;
      if ADOQuery4.Active then
      begin
        StringGrid1.Cells[l,0] := '养路费';
        ADOQuery4.First ;
        for k := 0 to i do
        begin
          if ADOQuery4.Fields[0].asstring = StringGrid1.Cells[0,k + 1] then
            StringGrid1.Cells[l,k + 1] := ADOQuery4.Fields[1].asstring;
          ADOQuery4.Next ;
        end;
        l := l + 1 ;
      end;
      if ADOQuery5.Active then
      begin
        StringGrid1.Cells[l,0] := '交通规费';
        ADOQuery5.First ;
        for k := 0 to i do
        begin
          if ADOQuery5.Fields[0].asstring = StringGrid1.Cells[0,k + 1] then
            StringGrid1.Cells[l,k + 1] := ADOQuery5.Fields[1].asstring;
          ADOQuery5.Next ;
        end;
        l := l + 1 ;
      end;
      if ADOQuery6.Active then
      begin
        StringGrid1.Cells[l,0] := '工商';
        ADOQuery6.First ;
        for k := 0 to i do
        begin
          if ADOQuery6.Fields[0].asstring = StringGrid1.Cells[0,k + 1] then
            StringGrid1.Cells[l,k + 1] := ADOQuery6.Fields[1].asstring;
          ADOQuery6.Next ;
        end;
        l := l + 1 ;
      end;
      if ADOQuery7.Active then
      begin
        StringGrid1.Cells[l,0] := '保险';
        ADOQuery7.First ;
        for k := 0 to i do
        begin
          if ADOQuery7.Fields[0].asstring = StringGrid1.Cells[0,k + 1] then
            StringGrid1.Cells[l,k + 1] := ADOQuery7.Fields[1].asstring;
          ADOQuery7.Next ;
        end;
        l := l + 1 ;
      end;
      if ADOQuery8.Active then
      begin
        StringGrid1.Cells[l,0] := '代收税费';
        ADOQuery8.First ;
        for k := 0 to i do
        begin
          if ADOQuery8.Fields[0].asstring = StringGrid1.Cells[0,k + 1] then
            StringGrid1.Cells[l,k + 1] := ADOQuery8.Fields[1].asstring;
          ADOQuery8.Next ;
        end;
        l := l + 1 ;
      end;
      if ADOQuery9.Active then
      begin
        StringGrid1.Cells[l,0] := '路单押金';
        ADOQuery9.First ;
        for k := 0 to i do
        begin
          if ADOQuery9.Fields[0].asstring = StringGrid1.Cells[0,k + 1] then
            StringGrid1.Cells[l,k + 1] := ADOQuery9.Fields[1].asstring;
          ADOQuery9.Next ;
        end;
        l := l + 1 ;
      end;
      if ADOQuery10.Active then
      begin
        StringGrid1.Cells[l,0] := '路单';
        ADOQuery10.First ;
        for k := 0 to i do
        begin
          if ADOQuery10.Fields[0].asstring = StringGrid1.Cells[0,k + 1] then
            StringGrid1.Cells[l,k + 1] := ADOQuery10.Fields[1].asstring;
          ADOQuery10.Next ;
        end;
        l := l + 1 ;
      end;
      if ADOQuery11.Active then
      begin
        StringGrid1.Cells[l,0] := '交易费';
        ADOQuery11.First ;
        for k := 0 to i do
        begin
          if ADOQuery11.Fields[0].asstring = StringGrid1.Cells[0,k + 1] then
            StringGrid1.Cells[l,k + 1] := ADOQuery11.Fields[1].asstring;
          ADOQuery11.Next ;
        end;
        l := l + 1 ;
      end;
      if ADOQuery12.Active then
      begin
        StringGrid1.Cells[l,0] := '保证金';
        ADOQuery12.First ;
        for k := 0 to i do
        begin
          if ADOQuery12.Fields[0].asstring = StringGrid1.Cells[0,k + 1] then
            StringGrid1.Cells[l,k + 1] := ADOQuery12.Fields[1].asstring;
          ADOQuery12.Next ;
        end;
        l := l + 1 ;
      end;
      if ADOQuery13.Active then
      begin
        StringGrid1.Cells[l,0] := '互助金';
        ADOQuery13.First ;
        for k := 0 to i do
        begin
          if ADOQuery13.Fields[0].asstring = StringGrid1.Cells[0,k + 1] then
            StringGrid1.Cells[l,k + 1] := ADOQuery13.Fields[1].asstring;
          ADOQuery13.Next ;
        end;
        l := l + 1 ;
      end;
     
    这就是我的一个完整的程序
      

  7.   

    晕哦,要不发个到我信箱来吧,我帮你看看
    [email protected]