I wish to populate a query with a few sql statements (with parameters) before actually executing them. Is there a way to have each statement with parameters compiled when I add them or do I have to assign unique parameters for each statement?
For example
Code: Select all
Query.SQL.Add('INSERT INTO table VALUES(:id, :name);');
Query.Params[0].AsInteger := 1;
Query.Params[1].AsString := 'First';
// compile here
Query.SQL.Add('INSERT INTO table VALUES(:id, :name);');
Query.Params[0].AsInteger := 2;
Query.Params[1].AsString := 'Second';
// compile here
Query.Execute;
Thanks.