This is something I just discovered in a report I was doing that uses SQL
queries running on Paradox tables.
One of the options when choosing data for the report is to have a range of
dates with the range being set by a pair of TDateTimePicker controls. These
become the inputs to a parameterised query using the Date property of the
TDateTimePicker converting it to the TParam in the query.
I discovered that using a range of only one day, records with the date of
that day were not selected but if the range was extended a day in one
direction, then records would be selected.
The query worked correctly using literals both in DBD and Delphi and the
next step was to look at the value of the Date property of the TDateTime. It
turns out that this is actually the Date and Time parameters combined (in
spite of the fact that these are separate properties). Since I was using the
.AsDateTime property of the TParam to convert it, that only leaves me to
speculate that the time information was input to the query and resulted in
the records being rejected because the Date field in each record would
presumably have the Time portion set to zero when it is read into the query.
The solution which has worked has been to change .AsDateTime to .AsDate
wherever necessary.
Anyone encounter a scenario like this before? Since I am using D3 it may
well have been addressed in D4 or later.
============================================
Patrick Dunford, Christchurch, NZ
http://patrick.dunford.com/
---------------------------------------------------------------------------
New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz