Link to home
Create AccountLog in
Avatar of hidrau
hidrauFlag for Brazil

asked on

I need to make a query but I don't figure out where is the problem with datetime

I made a query where I want all the records that their datetime is less than now()

But no records my query is retrieving me, why?

With Query do
Begin
     Close;
      Sql.Clear;
      Sql.Add('SELECT * FROM CTRSERVFAX');
      Sql.Add('WHERE SVFX_DATETIME<=:DT AND SVFX_STATUSFAX<>"E"');
      Sql.Add('ORDER BY SVFX_DATAHORA DESC');
      Parameters.ParamByName('DT').Value := Now();
      Open;
end


I use access as my database.

Thanks
Avatar of esoftbg
esoftbg
Flag of Bulgaria image

Try this (not tested):

      Parameters.ParamByName('DT').Value := DateTime(Now);
Avatar of hidrau

ASKER

Datetime doesn't exist in D5?
I got a delphi message = Undeclared identifier Datetime
ASKER CERTIFIED SOLUTION
Avatar of esoftbg
esoftbg
Flag of Bulgaria image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer