🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #3404

Re: Select Access Date/Time

#3404
From: Vassiliev V.V.
Date: Mon, 16 Sep 2002 11:30
76 lines
2695 bytes
You can try DateValue() function in Select such as

"SELECT * FROM tblDate WHERE fldDate = DateValue(" + DateTimeToStr(dateTime)
+ ");"

or, better, use a parameter.

Regards,
Viatcheslav V. Vassiliev
http://www.oledbdirect.com
The fastest way to work with MS SQL Server and MS Jet databases.


"John Larsson" <john.f.l@telia.com> �������/�������� � �������� ���������:
news:3d845d54$1@newsgroups.borland.com...
> 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: <3d85ca16@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!news.tele.dk!small.news.tele.dk!213.73.101.75!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3d845d54$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,9ecc55f5a5f7a282
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-09-16 07:43:06 PST
From: "Vassiliev V.V." <news@vassilievvv.mtu-net.ru>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3d845d54$1@newsgroups.borland.com>
Subject: Re: Select Access Date/Time
Date: Mon, 16 Sep 2002 15:30:53 +0400
Lines: 78
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: 212.188.101.174
Message-ID: <3d85ca16@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1032178198 212.188.101.174 (16 Sep 2002 05:09:58 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!small.news.tele.dk!213.73.101.75!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail