DateTime parameters in ADOQuery



I got a strange problem about the DateTime field in MSAccess.

A field in the Access table defined as DateTime, I have the SQL in ADOQuery
SELECT *
FROM Employee
WHERE (DateHired > :StartRange)
AND (DateHired <= :EndRange)

This is my code:
QryEmployee.Close;
QryEmployee.Parameters.ParamByName(StartRange).Value :=
dtThisMonthStocktakeDate;
QryEmployee.Parameters.ParamByName(EndRange).Value :=
dtNextMonthStocktakeDate;
QryEmployee.Open;
if QryEmployee.Eof then
showmessage('no employee');

I found that it always return no employee.
I also checked that the parameter value I passed are correct, eg
1/03/2007 and 1/06/2007

It should have employee return by checking the tables it has employee in
this range.

Any idea?


.



Relevant Pages

  • Re: Storing only timepart in Sql server datetime
    ... I'm using a DateTime field in MS SQL 2000, and by using Delphi's Frac method ... > stuck with setting up a character data type for the time portion only. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Typed dataset: Time only data in SQL dateTime Field
    ... I can type in a Time alone directly into a sql DateTime field. ... I need to retain the format as it was in access. ... how be able to provide input to my typed dataset to replicate the behavior. ... I also noticed that the Sql import was able to replicate this format. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Information between specific dates
    ... a dateTime field. ... After you answer that perhaps you can post the SQL view of your query. ... Access MVP 2002-2005, 2007-2008 ... Center for Health Program Development and Management ...
    (microsoft.public.access.queries)
  • Re: UPDATING/INSERTING DATETIME FIELDS FROM ASP?
    ... I think I will need to use calculations at some point, is there a way to pass the Nowvalue into the datetime field. ... I would have used the timestamp but it isn't available on my SQL server. ... Please reply to the newsgroup. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Typed dataset: Time only data in SQL dateTime Field
    ... typed dataset. ... We are in the process of moving from access to Sql 2000. ... I now have 2 typed datasets one pointing to a table in access and one ... DateTime field expected to have only a time in it. ...
    (microsoft.public.dotnet.framework.adonet)