Re: DateTime parameters in ADOQuery
- From: Brian Bushay TeamB <BBushay@xxxxxxxxx>
- Date: Wed, 30 May 2007 20:04:31 -0500
I got a strange problem about the DateTime field in MSAccess.What datatype are your parameters and the dtNextMonthStocktakeDate variables?
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.
They should be DateTime datatypes if you are going to use parameters. It
appears you are passing strings with the values you say you see
--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx
.
- References:
- DateTime parameters in ADOQuery
- From: Alan T
- DateTime parameters in ADOQuery
- Prev by Date: Re: Delete record in batch mode
- Next by Date: Re: Data type char and text incompatible
- Previous by thread: Re: DateTime parameters in ADOQuery
- Next by thread: Using TADOConnection with MSSQL, login failure
- Index(es):
Relevant Pages
|