Article View: borland.public.cppbuilder.database.ado
Article #3029Re: Query problem with MSSQL using ADO
From: aadr
Date: Fri, 27 Dec 2002 18:53
Date: Fri, 27 Dec 2002 18:53
26 lines
2106 bytes
2106 bytes
> qRooms->Close();
> qRooms->SQL->Clear();
> qRooms->SQL->Add("Select * from Billeting where (SDATE >=:startdate
and");
> qRooms->SQL->Add("SDATE <=:enddate) or (EDATE >=:startdate and");
> qRooms->SQL->Add("EDATE <=:enddate) or (SDATE <:startdate and");
> qRooms->SQL->Add(" :startdate < EDATE) order by BLDG");
> qRooms->Parameters->ParamByName("startdate")->Value =
StrToDate(VOQDate);
> qRooms->Parameters->ParamByName("enddate")->Value = (StrToDate(VOQDate)
+
> 14);
> qRooms->Open();
>
you must set type for parameters startdate and enddate as ftString, by
default this parameters have type ftDateTime, and set values as String, this
my code:
m_quTicketsInDates_forDraw->Close();
m_quTicketsInDates_forDraw->Parameters->ParamByName("DATESTART")->Value=Form
atDateTime("yyyy-mm-dd hh:nn:ss",dateStart);
m_quTicketsInDates_forDraw->Parameters->ParamByName("DATEEND")->Value=Format
DateTime("yyyy-mm-dd hh:nn:ss",dateEnd);
m_quTicketsInDates_forDraw->Open();
Technical Details
Message-ID:
<3e0ca483$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-mailReferences:
<3def7280@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,84b8f6b246c9be3f,start X-Google-Attributes: gid10698b,public X-Google-Thread: fc5f9,84b8f6b246c9be3f,start X-Google-Attributes: gidfc5f9,public X-Google-ArrivalTime: 2002-12-27 11:09:18 PST Reply-To: "aadr" <aadr@mail.ru> From: "aadr" <aadr@mail.ru> Newsgroups: borland.public.cppbuilder.database.ado,borland.public.cppbuilder.database.sqlservers References: <3def7280@newsgroups.borland.com> Subject: Re: Query problem with MSSQL using ADO Date: Fri, 27 Dec 2002 21:53:52 +0300 Lines: 29 Organization: avk X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 NNTP-Posting-Host: 212.188.64.62 Message-ID: <3e0ca483$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1041015939 212.188.64.62 (27 Dec 2002 11:05:39 -0800) 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