🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Data/Time literals and Access Query

#1907
From: Freshy
Date: Fri, 16 Jan 2004 14:07
51 lines
2250 bytes
I know that this does not really answer your question, but I usually use the
Format function:

WHERE Format(MyDateTimeField,"MM/DD/YYYY") >
Format("01-01-2004","MM/DD/YYYY)

This lets me keep things as strings which are much easier to deal with (IMO)

HTH,
Ken

"Claudio Andre Heckler" <Claudio.Heckler@flexint.RemoveThis.com> wrote in
message news:4007ee3b$1@newsgroups.borland.com...
> Hi there, this is getting me nuts ...
>
> How do I add date/time literals to a SQL query for Access?
>
> I'm trying to run something like this:
>
>     Select * from MyTable Where
>     MyDateTimeField > #2004-01-01 00:00:00#;
>
> But using # as the data/time delimiters makes CBuilder complain with an
> "Parameter
> object is improperly defined. Inconsistent or incomplete information was
> provided."
> error message.
>
>
> I traced the error to the #s: if I query for something like this:
>
>     Select * from MyTable Where
>     MyNumericField > 100;
>
> I don't get any errors, it all works fine.
>
>
> I don't want to use parameters, I much rather embed my filter in the WHERE
> clause.
>
> So, long story short: how do I embed MS-Access date/time literals in a
> CBuilder SQL
> query ???
>
>
> Many thanks in advance!
>
> Claudio
>
>
>
Technical Details
Message-ID: <4007f007@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4007ee3b$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,d7ad53e2c902349e,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2004-01-16 06:10:10 PST
From: "Freshy" <_REMOVE_THIS_freshy_s@hotmail.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <4007ee3b$1@newsgroups.borland.com>
Subject: Re: Data/Time literals and Access Query
Date: Fri, 16 Jan 2004 08:07:02 -0600
Lines: 53
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 65.123.110.23
Message-ID: <4007f007@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1074262023 65.123.110.23 (16 Jan 2004 06:07:03 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail