Subject | SV: [firebird-support] Filtering |
---|---|
Author | Svein Erling Tysvær |
Post date | 2011-01-20T21:44:29Z |
>I have a firebird db, with two fields defined as:I don't know your environment, but generally, it is a lot better to use a query or cursor component than a table. Translating your 'filter' above, I'd recommend the following statement:
>
> LO_NBR_ BIGINT NOT NULL
> HI_NBR_ BIGINT NOT NULL
>
>I then try to filter the records
>
>as_the_filter := StrToFloat(number1) + '>=' + FloatToStr(lo_nbr) + ' and ' + StrToFloat(number1) + '<=' + >FloatToStr(hi_nbr);
SELECT <whatever>
FROM <MyTableName>
WHERE LO_NBR_ <= :Number1
AND HI_NBR_ >= :Number1
[alternatively, you could try:
SELECT <whatever>
FROM <MyTableName>
WHERE :Number1 between LO_NBR_ AND HI_NBR_
]
Then prepare the statement, set the parameter and open your cursor/query.
If you insist on using a filter, then I don't understand why you use StrToFloat. as_the_filter surely have to be string and number1 a number, so FloatToStr would be more appropriate?
HTH,
Set