Advertisement

03.27.2008 at 08:36AM PDT, ID: 23274442
[x]
Attachment Details

ADO Query - change DateTimePicker format to yyyy-mm-dd

Asked by a3dvm in Delphi Database, Delphi Programming, Delphi Programming Language

Tags: Delphi, Ado, Jet

Hi
New to Delphi & programming.
Using Delphi 7 / Access db(2003) / ADO query / Jet 4.0 conn.
sDateEdit1 & 2 are AlphaSkin versions of Delphi DateTimePicker input fields, on a User Query form.
Trying to return records for wedding_date date range between these two date edit boxes and have
fallen foul of the Access # # and YYYY-MM-DD format issues.
Have got (finally...) to the sql below, but don't know how to format the sDateEdit1 & 2 fields to accept a User's date in dd/mm/yyyy format - but pass to SQL as YYYY-MM-DD format.

ADOQuery3.Close;
    ADOQuery3.SQL.Clear;
    ADOQuery3.SQL.Add ('SELECT Name_first, Name_Last, Wedding_Date FROM Contacts WHERE Wedding_Date BETWEEN #'+DateEdit1.Text+'# AND #'+dateEdit2.Text+'# order by wedding_date, name_last, Name_first') ;
    ADOQuery3.Parameters.Clear;
    ADOQuery3.Open;
    dbgrid1.DataSource:=datasource3;
If I manually type dates in as say, 2008-01-01 - 2008-06-01 it all seems to work. So hopefully, if one of you smart guys can advise how to make the DateTimePicker convert a date to that format, all should be well!
Thanks,
DenStart Free Trial
 
 
[+][-]03.27.2008 at 08:39AM PDT, ID: 21222549

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.

 
[+][-]03.27.2008 at 09:12AM PDT, ID: 21222996

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.

 
[+][-]03.27.2008 at 09:15AM PDT, ID: 21223031

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, Delphi Programming Language
Tags: Delphi, Ado, Jet
Sign Up Now!
Solution Provided By: MerijnB
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.27.2008 at 09:18AM PDT, ID: 21223078

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.

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