Subject | RE: [IBO] list of values in a parameter |
---|---|
Author | IBO Support List |
Post date | 2013-03-19T14:48:38Z |
You could do this:
select *
from table
where the_key in ( :param1, :param2, :param3, :param4, ... )
Myquery.parambyname( 'param1' ).AsInteger := '1';
Myquery.parambyname( 'param2' ).AsInteger := '2';
Myquery.parambyname( 'param3' ).AsInteger := '3';
Myquery.parambyname( 'param4' ).AsInteger := '4';
...
You would just have to put the maximum number of parameters and then put in
the same value as the last actual one in the rest of them.
Jason
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of l_gilbert_fr
Sent: Tuesday, March 19, 2013 4:03 AM
To: IBObjects@yahoogroups.com
Subject: [IBO] list of values in a parameter
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.
------------------------------------
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links
select *
from table
where the_key in ( :param1, :param2, :param3, :param4, ... )
Myquery.parambyname( 'param1' ).AsInteger := '1';
Myquery.parambyname( 'param2' ).AsInteger := '2';
Myquery.parambyname( 'param3' ).AsInteger := '3';
Myquery.parambyname( 'param4' ).AsInteger := '4';
...
You would just have to put the maximum number of parameters and then put in
the same value as the last actual one in the rest of them.
Jason
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of l_gilbert_fr
Sent: Tuesday, March 19, 2013 4:03 AM
To: IBObjects@yahoogroups.com
Subject: [IBO] list of values in a parameter
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.
------------------------------------
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links