🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Problem with parameters and date fields

#1303
From: Francesco
Date: Mon, 09 Aug 2004 09:58
30 lines
1458 bytes
Hello, 

I've a problem, a simple query like the follow give me the wrong result
TOTAL=0


ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("SELECT COUNT(*) AS TOTAL FROM SCHEMAS WHERE
DATAARR < :data1 AND DATAPAR >= :data1");
ADOQuery1->Parameters->ParamByName("data1")->Value =
StrToDate("13/08/2004");
ADOQuery1->Open();


if I do the same query but in this way, I've the correct result TOTAL=1


SELECT COUNT(*) AS TOTAL
FROM SCHEMAS
WHERE DATAARR < CAST('13/08/2004' AS DATETIME)
AND DATAPAR >= CAST ('13/08/2004' AS DATETIME)


Is there any know problem using parameters with date fields, both
fields DATAARR AND DATAPAR are defined as datetime (8).


thanks, Francesco
Technical Details
Message-ID: <41174ae2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!newsfeed.iinet.net.au!newsfeed.iinet.net.au!PeerFeed.KWeb.on.ca!news.kweb.on.ca!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,33d4f63ac70a410f,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Francesco" <.>
Subject: Problem with parameters and date fields
Newsgroups: borland.public.cppbuilder.database.ado
User-Agent: XanaNews/1.16.3.1
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 217.172.212.72
Message-ID: <41174ae2@newsgroups.borland.com>
Date: 9 Aug 2004 02:58:58 -0700
X-Trace: newsgroups.borland.com 1092045538 217.172.212.72 (9 Aug 2004 02:58:58 -0700)
Lines: 33
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!newsfeed.iinet.net.au!newsfeed.iinet.net.au!PeerFeed.KWeb.on.ca!news.kweb.on.ca!newsgroups.borland.com!not-for-mail