selas
asked on
datetime compare error
On button click i get error near: where time > 2004.08.02 14NULL
procedure TForm8.RadioButton1Click(S ender: TObject); //ESANTYS
begin
RadioButton1.Checked := True;
AdoQuery1.SQL.Clear;
AdoQuery1.SQL.Add('Select id, time from esantys where time > 2004.08.02 14:00:00');
AdoQuery1.Open;
end;
How to make this work?
procedure TForm8.RadioButton1Click(S
begin
RadioButton1.Checked := True;
AdoQuery1.SQL.Clear;
AdoQuery1.SQL.Add('Select id, time from esantys where time > 2004.08.02 14:00:00');
AdoQuery1.Open;
end;
How to make this work?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or better, let Borland do this with params
adoQuery1.SQL.add('Select id, time from esantys where time > :Param');
adoQuery1.paramByName('Par am').AsDat eTime := Date;
Edu
adoQuery1.SQL.add('Select id, time from esantys where time > :Param');
adoQuery1.paramByName('Par
Edu
AdoQuery1.SQL.Add('Select id, time from esantys where time > ');
AdoQuery1.SQL.Add(QuotedSt r(2004.08. 02));
sorry I did not test, does it help ?
AdoQuery1.SQL.Add(QuotedSt
sorry I did not test, does it help ?
must be
AdoQuery1.SQL.Add(QuotedSt r('your value here'));
like
AdoQuery1.SQL.Add(QuotedSt r('2004.08 .02')); or ...
AdoQuery1.SQL.Add(QuotedSt
like
AdoQuery1.SQL.Add(QuotedSt
try the following format:
yyyy/mm/dd hh:mm:ss
meikl ;-)
yyyy/mm/dd hh:mm:ss
meikl ;-)
i always do it this way:
'select * from timetable where time > ' + IntToStr(Trunc(My Date Variable here...))
that way you treat the date variable as a numeric value. always works for me! and i got the tip from this forum too
'select * from timetable where time > ' + IntToStr(Trunc(My Date Variable here...))
that way you treat the date variable as a numeric value. always works for me! and i got the tip from this forum too
remove the trunc if you want time values in addition. not just the date value
like this:
FloatToStr(My Date Value)
like this:
FloatToStr(My Date Value)
What database are you using?
Regards, Geo