procedure TForm2.Button8Click(Sender: TObject);
var
str1,str2:string;begin
  with adoquery2 do
  begin
  str1:=datetimetostr(DateTimePicker3.datetime);
  str2:=datetimetostr(DateTimePicker4.datetime);
  if ComboBox4.Text='' then
  begin
  close;
  sql.Clear;
  sql.Add('select * from sj where yh='''+yhs+''' and  date1>='''+str1+''' and date1<='''+str2+'''') ;
  open;
  end
  else
  begin
   if ComboBox3.text='' then
   begin
      close;
  sql.Clear;
  sql.Add('select * from sj where date1<=:'''+str1+''' and date1>=:'''+str2+''' and zc='''+ComboBox4.text+''' and yh='''+yhs+''' ') ;
   open;
   end
   else
   begin
       close;
  sql.Clear;
  sql.Add('select * from sj where date1<=:'''+str1+''' and date1>=:'''+str2+''') and zc='''+ComboBox4.text+''' and ly='''+ComboBox3.text+''' and yh='''+yhs+''' ') ;
    open;
   end;
  end;
  end;
end;