Article View: borland.public.cppbuilder.database.ado
Article #3401Select Access Date/Time
From: John Larsson
Date: Sun, 15 Sep 2002 10:13
Date: Sun, 15 Sep 2002 10:13
57 lines
2017 bytes
2017 bytes
Hello,
I'm having trouble with selecting date/time from an Access database. Access
is storing date/time as "m/d/yyyy h:n:s ", that is without the leading zero
e.g. (7/9/2002 1:6:6) .
When reading from a ini-file I'm getting the date/time as 2002-09-07
01:06:06, what I'm doing is:
TDateTime dateTime = mIni->ReadString("basics", "date", DEFAULT );
String sql = "SELECT * FROM tblDate WHERE fldDate = #" +
dateTime.FormatString("m'/'d'/'yyyy h:n:s") + "#";
ADOQuery1->Close();
ADOQuery1->Prepared = false;
ADOQuery1->SQL->Text = sql;
ADOQuery1->Prepared = true;
ADOQuery1->Open();
When debugging this, the date is matching Access underlying format, but it
will not work.
The debugger is reporting:
"EoleException with message, parameter-object is defined wrong. The given
information is inconsequent or incomplete".
I then created a view in Access and come up with the following:
SELECT tblDate.fldDate
FROM tblDate
WHERE (((tblDate.fldDate)=#9/9/2002 1:6:6#));
When passing that I'm getting the same error, what is wrong here?
Thanks in advance,
John
Technical Details
Message-ID:
<3d845d54$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,9ecc55f5a5f7a282,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2002-09-15 05:18:02 PST From: "John Larsson" <john.f.l@telia.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: Select Access Date/Time Date: Sun, 15 Sep 2002 12:13:40 +0200 Lines: 59 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 217.208.11.244 Message-ID: <3d845d54$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1032084820 217.208.11.244 (15 Sep 2002 03:13:40 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail