Subject Re: [IBO] using Parameters with null value
Author Markus Ostenried
At 08:17 Saturday, 12.07.2003 +0000, you wrote:
>Iam new in using parameters
>
>for example I have ib_query like this
>
>select *
>from customer
>where type = :paramtype
>
>then i will be having a onclick event for a button like this
>
>ib_query.parambyname('paramtype').asstring = 'ABC';
>ib_query.refresh;
>so what happen is all the records with type = 'ABC' will be show
>
>what if I want all records to be shown? What should I do? Is there
>something like this
>
>ib_query.parambyname('paramtype').asstring = *
>or
>ib_query.parambyname('paramtype').asstring = any;

Hi,
you have two options here:

1) You can use the OnPrepareSQL event and only add a where clause when it's
needed
2) You can change your SQL statement to something like this:
select *
from customer
where (type = :paramtype) or (Cast('*' as VarChar(3)) = :paramtype)
Note that you need to cast your constant value to the same field type that
you have defined your column with. Otherwise IBO will create a second
parameter of type Char(1).

HTH,
Markus