Repeated parameters in MSQuery
Posted: Mon 03 Nov 2014 21:00
Hi,
I am having the following problem to set some parameters in a MSQuery. When own parameters that are repeated in the query and dynamically create (CreateParam or ParseSQL), the second value is NULL when seen in Profiler.
Example:
The query is generated with the last parameter NULL. If i make a loop and set the two parameters, it works.
This way it works:
Does anyone know why this happens?
I am having the following problem to set some parameters in a MSQuery. When own parameters that are repeated in the query and dynamically create (CreateParam or ParseSQL), the second value is NULL when seen in Profiler.
Example:
Code: Select all
MSQueryPl1.ParamCheck := False;
MSQueryPl1.SQL.Text := 'select * from table where field = :field and '''' <> :field';
MSQueryPl1.Params.ParseSQL(MSQueryPl1.SQL.Text, True);
MSQueryPl1.ParamByName('field', 'value', ftString);
This way it works:
Code: Select all
MSQueryPl1.ParamCheck := True;
MSQueryPl1.SQL.Text := 'select * from table where field = :field and '''' <> :field';
MSQueryPl1.ParamByName('field', 'value', ftString);