Advertisement

05.07.2008 at 12:45AM PDT, ID: 23381896
[x]
Attachment Details

Delphi 7 :: TADO Dataset Filter Property :: Cast DateTime  Field to Date

Asked by Marius0188 in Delphi Database, Delphi Programming

Hi Experts,

I am using a TADOTable component.
In my database table I have a TDateTime field.

My idea is to filter all rows for a given date range by using the Filter property.
How would the syntax look for this as I would firstly need to cast the TDateTime field to TDate and then
specify the ranges.

In SQL it would have looked something like this:

SELECT * FROM TABLE1
WHERE
CAST(FLOOR(CAST(DateTimeFiled AS FLOAT)) AS DATETIME) > :DATE1
AND
CAST(FLOOR(CAST(DateTimeFiled AS FLOAT)) AS DATETIME) < :DATE2

Thanks!Start Free Trial
[+][-]05.07.2008 at 12:54AM PDT, ID: 21513974

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 12:58AM PDT, ID: 21513997

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Delphi Database, Delphi Programming
Sign Up Now!
Solution Provided By: ziolko
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.07.2008 at 01:06AM PDT, ID: 21514030

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.07.2008 at 02:11AM PDT, ID: 21514435

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628