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 Traffic WHERE Transactions=:Transactions' FDQuery1.ParamByName('Transactions').AsString := '0'; FDQuery1.Open;
- If you need to execute a command only once, set ResourceOptions.DirectExecute to true.
- The connection must be active and open while a statement is prepared.