Article View: borland.public.cppbuilder.database.ado
Article #5724Re: Getting DateTime Field from MSACCESS
From: Bruce Lecus
Date: Mon, 26 Feb 2001 01:30
Date: Mon, 26 Feb 2001 01:30
46 lines
2075 bytes
2075 bytes
Koert,
What is the error message?
Try ADOQuery1->FieldByName("Dag")->AsDateTime
Bruce.
Koert Wilmink wrote:
> Hi all,
>
> I have a MSACCESS database with a table called "Dag" with a field called
> "Dag" with type Date.
> I want to decode this date field, thirst I'm assigning this field to Gdate,
> GDate = ADOQuery1->FieldValues["Dag"];
>
> The compiler is giving me an error! What is wrong ????? See the following
> code:
>
> Word GYear, GMonth, GDay;
> TDateTime GDate;
>
> ADOQuery1->Close();
> ADOQuery1->SQL->Clear();
> ADOQuery1->SQL->Add("SELECT * ");
> ADOQuery1->SQL->Add("FROM Dag ");
> ADOQuery1->SQL->Add("WHERE Employee = " + QuotedStr(AnEmployee));
> ADOQuery1->Open();
> ADOQuery1->First();
> while (!ADOQuery1->Eof)
> {
> GDate = ADOQuery1->FieldValues["Dag"];
> DecodeDate(GDate, GYear, GMonth, GDay);
> if (GYear == ComboBox1->Text) {
> StringGrid1->Cells[StrToInt(GMonth)-1][StrToInt(GDay)-1] = "
> V";
> }
> Form1->ADOQuery1->Next();
> }
> Form1->ADOQuery1->Close();
>
> Thanks,
>
> Koert Wilmink
> Koert@Wilmink.com
Technical Details
Message-ID:
<3A99B19D.6EC538D2@intrex.net>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!zeus.visi.com!hermes.visi.com!news-out.visi.com!nntp.primenet.com!nntp.gblx.net!news.tele.dk!130.133.1.3!fu-berlin.de!news.bnb-lp.com!bornews.borland.com!dnews!66.26.234.2References:
<3a996c8c_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,40287e849b7aae46 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-02-25 17:40:09 PST Message-ID: <3A99B19D.6EC538D2@intrex.net> Date: Sun, 25 Feb 2001 20:30:05 -0500 From: Bruce Lecus <bwlecus@intrex.net> X-Mailer: Mozilla 4.74 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: Getting DateTime Field from MSACCESS References: <3a996c8c_1@dnews> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 66.26.234.2 X-Trace: 25 Feb 2001 17:31:57 -0800, 66.26.234.2 Lines: 47 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!zeus.visi.com!hermes.visi.com!news-out.visi.com!nntp.primenet.com!nntp.gblx.net!news.tele.dk!130.133.1.3!fu-berlin.de!news.bnb-lp.com!bornews.borland.com!dnews!66.26.234.2