Delphi-Quellcode:
procedure DeleteClick(Sender: TObject);
var
sQuery : string;
begin
sQuery := 'DELETE FROM ' + DBNAME + ' WHERE seriennummer = 0000000000000000';
FDQuery.SQL.Clear;
FDQuery.SQL.Add(sQuery);
FDQuery.SQL.Add('SELECT * FROM ' + DBNAME);
FDQuery.Active := True;
SetGridColumnWidths(DBGrid);
end;
1. Keine globalen Variablen! (DBNAME)
2. Entweder Select oder Delete in der
Query
3. Select mit Open
4. Delete mit ExecSQL
5. Parameter verwenden
Delphi-Quellcode:
procedure DeleteClick(Sender: TObject);
var
sQuery : string;
begin
sQuery := 'DELETE FROM ' + DBNAME + ' WHERE seriennummer = :SER';
FDQuery.SQL.Text(sQuery);
FDQuery.ParamByName('SER').AsString := '000000000';
FDQuery.ExecSQL;
SetGridColumnWidths(DBGrid);
end;