Using SQL query

Posted in Databases

If you want to select something from your database, then use Query component and SQL language. This example shows, how to select all records, where "Boa" value is in the "NAME" field.

procedure TForm1.Button1Click(Sender: TObject);
begin
  with Query1 do
  begin
    Active:=False;
    SQL.Clear;
    SQL.Add('Select * from animals where name="Boa"');
    Active:=True;
  end;
end;