Help me to fix this problem to delete records with TFDQuery.
When this value of record is choosed by me with Edit.Text or DBEdit.Text, I try like this but it is not working:
FDQuery.SQL.Text := 'delete * FROM MyTable column_name =:KEY1 ';
FDQuery.ParamByName('KEY1').AsString = 'dbedit.text';
FDQuery.Open;
You could also use TFDCommand rather than TFDQuery as you are not expecting to read the result:
If this is a command you expect to re-use you could put the SQL statement into the command at design time, with the parameter name, and then at run time you would only need to do:
Depending on the underlying database you are using have commands pre-populated can allow the query to be prepared in advance. For complex queries (unlike this one) this means that the execution plan is built only once.