Advertisement
Gov_777

sql выборка

Jun 11th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.25 KB | None | 0 0
  1. procedure TFSearch.BitBtn1Click(Sender: TObject);
  2. var
  3. fwalls: string;
  4. begin
  5. if walls_P.Checked then fwalls := walls_P.Caption else fwalls := walls_K.Caption;
  6.  
  7.     //проверка значений
  8.   if string.IsNullOrEmpty(Edittotal_area.Text) then
  9.     Edittotal_area.Text := '0';
  10.   if string.IsNullOrEmpty(Editliving_space.Text) then
  11.     Editliving_space.Text := '0';
  12.   if string.IsNullOrEmpty(Editkitchen_area.Text) then
  13.     Editkitchen_area.Text := '0';
  14.   if string.IsNullOrEmpty(Edittotal_floors.Text) then
  15.     Edittotal_floors.Text := '0';
  16.   if string.IsNullOrEmpty(Editfloors.Text) then
  17.     Editfloors.Text := '0';
  18.   if string.IsNullOrEmpty(EditCost_of_sale.Text) then
  19.     EditCost_of_sale.Text := '0';
  20.  
  21.   if string.IsNullOrEmpty(Editborough.Text) then
  22.   begin
  23.     //вывод запроса, если район не введен
  24.     Main.ADOQuery1.SQL.Clear;
  25.     Main.ADOQuery1.SQL.Add('SELECT * FROM realtor WHERE total_area >= ' + Edittotal_area.Text +
  26.     ' and living_space >= ' + Editliving_space.Text +
  27.     ' and kitchen_area >= ' + Editkitchen_area.Text +
  28.     ' and bathroom = ' + BoolToStr(CheckBoxbathroom.Checked) +
  29.     ' and bathroom_affinity = ' + BoolToStr(CheckBoxbathroom_affinity.Checked) +
  30.     ' and loggia = ' + BoolToStr(CheckBoxloggia.Checked) +
  31.     ' and walls = ' + QuotedStr(fwalls) +
  32.     ' and total_floors <= ' + Edittotal_floors.Text +
  33.     ' and floors = ' + Editfloors.Text +
  34.     ' and Cost_of_sale <= ' + EditCost_of_sale.Text);
  35.     Main.ADOQuery1.Active := True;
  36.   end
  37.   else
  38.   begin
  39.     Main.ADOQuery1.SQL.Clear;
  40.     Main.ADOQuery1.SQL.Add('SELECT * FROM realtor WHERE borough LIKE ''' + Editborough.text + '%''' +
  41.     ' and total_area >= ' + Edittotal_area.Text +
  42.     ' and living_space >= ' + Editliving_space.Text +
  43.     ' and kitchen_area >= ' + Editkitchen_area.Text +
  44.     ' and bathroom = ' + BoolToStr(CheckBoxbathroom.Checked) +
  45.     ' and bathroom_affinity = ' + BoolToStr(CheckBoxbathroom_affinity.Checked) +
  46.     ' and loggia = ' + BoolToStr(CheckBoxloggia.Checked) +
  47.     ' and walls = ' + QuotedStr(fwalls) +
  48.     ' and total_floors <= ' + Edittotal_floors.Text +
  49.     ' and floors = ' + Editfloors.Text +
  50.     ' and Cost_of_sale <= ' + EditCost_of_sale.Text);
  51.     Main.ADOQuery1.Active := True;
  52.   end;
  53. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement