Prepared Statements
Executing Prepared Statements with FireDAC Classes
By default, TFDQuery prepares the query to avoid recompiling the same query over and over.
FDQuery1.SQL.Text := 'SELECT * FROM NorthwindOData WHERE personal.name.last=:personal.name.last' FDQuery1.ParamByName('personal.name.last').AsString := 'ana.trujilo@northwind.org'; FDQuery1.Open;
Notes
- If you need to execute a command only once, set ResourceOptions.DirectExecute to true.
- The TFDConnection class is most useful for one-off data manipulation commands, where prepared statements are unnecessary.
- The connection must be active and open while a statement is prepared.