Subject | Re: [IBO] list of values in a parameter |
---|---|
Author | lcampbell |
Post date | 2013-03-19T15:13:25Z |
On 3/19/2013 3:02 AM, l_gilbert_fr wrote:
I've found it works to build the SQL in the Delphi code, somewhat like this:
with theQuery do
begin
Close;
SQL.Clear;
SQL.Add('select * from the_table where thetable_key in (' +
my_StringList.CommaText + ') ' );
Open;
...
end;
Lane Campbell
>Laurent:
> 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.
>
I've found it works to build the SQL in the Delphi code, somewhat like this:
with theQuery do
begin
Close;
SQL.Clear;
SQL.Add('select * from the_table where thetable_key in (' +
my_StringList.CommaText + ') ' );
Open;
...
end;
Lane Campbell
>[Non-text portions of this message have been removed]
>
>