I want to query the data in a limited period e.g. from 3/2/2003 to 3/21/2003.
I get the desired result in sql sqrver 2000 using the statements as follows
where datacolumn between '3/2/2003' and '3/21/2003'
The query result include the data with the datacolumn in 3/2/2003 and 3/21/2003.
But unfortunately, when I execute the above statement in Delphi6.0 by TQuery like the following
frmdata.tsqlInvoice.SQL.add('Select * from tablename');
frmdata.tsqlInvoice.SQL.add('where datacolumn between :begin and :end');
frmdata.tsqlInvoice.Params.AsDateTime := dtpBegin.DateTime ;
frmdata.tsqlInvoice.Params.AsDateTime := dtpEnd.datetime;
The result excludes the data with the datacolumn in 3/2/2003. So, in order to get the data with the datacolumn in 3/2/2003 I have to set the begin date as 3/1/2003.
Can you tell me what the problem is and how to get the desired query result in Delphi6.0 professional?