Subject | Re: [IBO] list of values in a parameter |
---|---|
Author | Markus Ostenried |
Post date | 2013-03-19T15:00:57Z |
Hi,
you could also use the OnPrepareSQL event:
my_query.SQL.Text := 'select * from the_table'; // <- no WHERE anymore
// this triggers OnPrepareSQL
my_query.InvalidateSQL;
my_query.Refresh;
procedure TForm1.my_queryPrepareSQL(...);
begin
my_query.SQLWhereItems.Add('the_table_key in (' + my_StringList.CommaText
+ ')');
end;
HTH,
Markus
On Tue, Mar 19, 2013 at 11:02 AM, l_gilbert_fr <
laurent.gilbert@...> wrote:
you could also use the OnPrepareSQL event:
my_query.SQL.Text := 'select * from the_table'; // <- no WHERE anymore
// this triggers OnPrepareSQL
my_query.InvalidateSQL;
my_query.Refresh;
procedure TForm1.my_queryPrepareSQL(...);
begin
my_query.SQLWhereItems.Add('the_table_key in (' + my_StringList.CommaText
+ ')');
end;
HTH,
Markus
On Tue, Mar 19, 2013 at 11:02 AM, l_gilbert_fr <
laurent.gilbert@...> wrote:
> **[Non-text portions of this message have been removed]
>
>
> Hello all,
>
> I want to have something like that in a query :
>
> select * from the_table where the_table_key in (:selection);
>
> And in my program, I use :
>
> my_query.ParamByName('selection').AsString := my_StringList.CommaText;
>
> Is it really possible ?
>
> In my tests, the key is an integer and IBO raises an exception when I set
> the parameter to "1,2" for example. The exception is normal because the
> parameter is seen as an single integer value.
>
> If someone has a solution or an alternative.
>
> Thank you.
> Laurent.
>
>
>