🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: dates

#4474
From: Ronnie
Date: Mon, 07 Jan 2002 23:30
48 lines
2174 bytes
Fret,

I'm not familiar with Paradox-databases but I got the same behaviour in MS
Access databases. The problem has nothing to do with the Locale Settings of
Windows, the SQL-query simply always needs an English dateformat.

I use something like this:

AnsiString VarToQueryString(Variant VValue)
{
    AnsiString AReturn;
    switch (VValue.Type())
    {
        ...
        case varDate:
            // conversion to English Locale!
            AReturn = "#"+FormatDateTime("mm-dd-yyyy",VValue)+"#";
            break;
        ...
    }
...
}

Maybe this helps.

HTH
Ronald

"FretBuzzz" <gulanala@yahoo.com> schreef in bericht news:3c2b8b64_2@dnews...
> Hi,
>
> My app uses a Paradox table. One of the fields in the table is of type
> "Date".
> In the app I manipulate the database using SQL and a TQuery component.
> My problem is that the system's short date format has to be "MM/dd/yyyy"
> before any queries that use the date field will work. When the system's
> short date
> format is "dd/MM/yyyy", my queries simply don't work - I keep getting an
> error message: "Type mismatch in expression" - even when I double check
that
> the format of the date description in the sql statement is the same as
that
> of the system.
>
> Can anyone tell me what I am doing wrong?
> Fret
>
>
Technical Details
Message-ID: <3c3a2f0b$1_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!xmission!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <3c2b8b64_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,9d0576b06b44b3df
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-01-07 15:29:30 PST
From: "Ronnie" <r.loonstra@home.nl>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3c2b8b64_2@dnews>
Subject: Re: dates
Date: Tue, 8 Jan 2002 00:30:50 +0100
Lines: 50
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 213.51.193.131
Message-ID: <3c3a2f0b$1_2@dnews>
X-Trace: dnews 1010446091 213.51.193.131 (7 Jan 2002 15:28:11 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!xmission!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews