[Lazarus] Filtering on date with TDbf

Koenraad Lelong lazarus1 at de-brouwerij.be
Tue Jan 31 09:29:31 CET 2012


On 30-01-12 21:43, Chris Kelling wrote:
>
>
>
> On Mon, Jan 30, 2012 at 6:25 AM, Koenraad Lelong wrote:
>
>> tblTik.Filter:='DATUM>='''+DateToStr(XferStart)+'''';
>>
>> I get an error :
>> Index based on unknown field ">=".
>
> My guess is take a look at the location of your apostrophizes ('). You
> have 3 of them in a row in a couple of cases, which will interpreted as
> "print chr(39)" and not as a text dilimeter.
>

Hi,

Actually, that line comes from a Delphi application, where this works fine.
Could you tell me what the difference is between chr(39) and 'text 
delimiter' ? AFAIK in Pascal, the text delimiter _is_ chr(39).
And if there were errors, would the application compile ? Because if the 
number of apostrophes would be wrong, the string would not be closed.

I know with databases sometimes you have to use ', sometimes you have to 
use ". But I tried  both :

tblTik.Filter:='DATUM>="'+DateToStr(XferStart)+'"';

Gives the same error.

Anyway, thanks for your response.

Koenraad Lelong.




More information about the Lazarus mailing list