Board index » delphi » Again: DateTime in Firter doesn't work properly

Again: DateTime in Firter doesn't work properly

Is anyone able to tell me because a filter like that is not working in
Delphi 4 ?

'StartDate <=' + DateTimetoStr(ActualTime);

If I'm working only with the Date part of my variable the filter is working
properly.
I cannot use a query because my data are in a TClientDataSet that I build at
run time and has no provider.

I thanx everyone in advance

Alessandro Franchini
alessandro.franch...@syseca.ch

PS: this question was already posted.

 

Re:Again: DateTime in Firter doesn't work properly


Are you getting an error message, or is it just not returning the expected
rows?  You can get more control over filtering by using the OnFilterRecord
event handler.

V/R
Russell L. Smith

Quote
Alessandro Franchini wrote in message <6u7i4c$p...@forums.borland.com>...
>Is anyone able to tell me because a filter like that is not working in
>Delphi 4 ?

>'StartDate <=' + DateTimetoStr(ActualTime);

Re:Again: DateTime in Firter doesn't work properly


I'm getting an Exception of the Class EDatabaseError saying there is a wrong
character in the Filter String.
The wrong character is ":". This comes from the fact that the DateTimeToStr
function converts ActualTime in e.g. '01.01.1998 13:24:13'.
I thank you for your help

Alessandro Franchini
alessandro.franch...@syseca.ch

Russell L. Smith <Russell_L._Sm...@mail.amsinc.com> wrote in message
6u8ka4$qc...@forums.borland.com...

Quote
>Are you getting an error message, or is it just not returning the expected
>rows?  You can get more control over filtering by using the OnFilterRecord
>event handler.

>V/R
>Russell L. Smith

>Alessandro Franchini wrote in message <6u7i4c$p...@forums.borland.com>...
>>Is anyone able to tell me because a filter like that is not working in
>>Delphi 4 ?

>>'StartDate <=' + DateTimetoStr(ActualTime);

Re:Again: DateTime in Firter doesn't work properly


Although I have successfully used dates, I have never used times with the
TDataSet.Filter property.  I suggest using the TDataSet.OnFilterRecord event
handler instead, because then you can use object pascal and date/time
routines to help represent the filter condition.

V/R
Russell L. Smith

Quote
Alessandro Franchini wrote in message <6ua4dq$s...@forums.borland.com>...
>I'm getting an Exception of the Class EDatabaseError saying there is a
wrong
>character in the Filter String.
>The wrong character is ":". This comes from the fact that the DateTimeToStr
>function converts ActualTime in e.g. '01.01.1998 13:24:13'.

Other Threads