Thread View: borland.public.cppbuilder.database.ado
4 messages
4 total messages
Started by Koert Wilmink
Sun, 25 Feb 2001 20:33
Getting DateTime Field from MSACCESS
Author: Koert Wilmink
Date: Sun, 25 Feb 2001 20:33
Date: Sun, 25 Feb 2001 20:33
37 lines
1796 bytes
1796 bytes
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
Re: Getting DateTime Field from MSACCESS
Author: 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
Re: Getting DateTime Field from MSACCESS
Author: Koert Wilmink
Date: Mon, 26 Feb 2001 20:07
Date: Mon, 26 Feb 2001 20:07
71 lines
2760 bytes
2760 bytes
Hi Bruce,
I received the following error:
[C++ Error] Unit1.cpp(251): E2015 Ambiguity between '_fastcall
System::TDateTime::operator =(const System::TDateTime &)' and '_fastcall
System::TDateTime::operator =(const double)'
I did try your solution too ( Try ADOQuery1->FieldByName("Dag")->AsDateTime)
, I received the next error:
[C++ Error] Unit1.cpp(251): E2288 Pointer to structure required on left side
of -> or ->*
Thanks for your help!!
Best regards
Koert Wilmink
"Bruce Lecus" <bwlecus@intrex.net> wrote in message
news:3A99B19D.6EC538D2@intrex.net...
> 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
>
Re: Getting DateTime Field from MSACCESS
Author: Bruce Lecus
Date: Sat, 03 Mar 2001 13:17
Date: Sat, 03 Mar 2001 13:17
82 lines
3096 bytes
3096 bytes
Koert,
Not sure why you would receive an E2288 error. Which pointer does he have a
problem with?
Also, instead of a WORD, I put my dates into a TDateTime field and then decode.
Bruce.
Koert Wilmink wrote:
> Hi Bruce,
>
> I received the following error:
>
> [C++ Error] Unit1.cpp(251): E2015 Ambiguity between '_fastcall
> System::TDateTime::operator =(const System::TDateTime &)' and '_fastcall
> System::TDateTime::operator =(const double)'
>
> I did try your solution too ( Try ADOQuery1->FieldByName("Dag")->AsDateTime)
> , I received the next error:
> [C++ Error] Unit1.cpp(251): E2288 Pointer to structure required on left side
> of -> or ->*
>
> Thanks for your help!!
>
> Best regards
>
> Koert Wilmink
>
> "Bruce Lecus" <bwlecus@intrex.net> wrote in message
> news:3A99B19D.6EC538D2@intrex.net...
> > 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
> >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads