Thread View: borland.public.cppbuilder.database.ado
6 messages
6 total messages
Started by ht
Thu, 02 Nov 2006 07:53
Why have I got wrong record from this table?
Author: ht
Date: Thu, 02 Nov 2006 07:53
Date: Thu, 02 Nov 2006 07:53
7 lines
1475 bytes
1475 bytes
I used ADO to access a Ms Access database.I put a TAdoConnection, a TADOTable, a TDataSource and a TDBGrid into the Form,the I have actived the dataset,but some datas displayed in the grid is dislike that in the Ms Access.especially the field whose type is DateTime,for example:In ms access a record's datetime field is 2006-11-20 12:12:31,but in my test application, this field has changed to 2006-11-20 12:12:31,so I tested this database in vb by ocx,the result is correct.Is the reason in my access table???
Why have I got wrong record from this table?
Author: ht
Date: Thu, 02 Nov 2006 14:27
Date: Thu, 02 Nov 2006 14:27
9 lines
1405 bytes
1405 bytes
"ht" <ht_ftp@km169.net> д���ʼ� news:4549a412@newsgroups.borland.com... I used ADO to access a Ms Access database.I put a TAdoConnection, a TADOTable, a TDataSource and a TDBGrid into the Form,the I have actived the dataset,but some datas displayed in the grid is dislike that in the Ms Access.especially the field whose type is DateTime,for example:In ms access a record's datetime field is 2006-11-20 12:12:31,but in my test application, this field has changed to 2006-11-20 12:12:30,so I tested this database in vb by ocx,the result is correct.Is the reason in my access table???
Re: Why have I got wrong record from this table?
Author: Clayton Arends
Date: Thu, 02 Nov 2006 17:15
Date: Thu, 02 Nov 2006 17:15
17 lines
1476 bytes
1476 bytes
> 2006-11-20 12:12:31
> 2006-11-20 12:12:31
I see no difference in these two date values. What did you mean to type?
To control the display format of a field you can find the field in the
dataset and then modify the 'DisplayFormat' property to your liking.
For instance to specify that the display format should be "2006/11/20":
TDateTimeField* field = dynamic_cast <TDateTimeField*>
(DataSet1->Fields->FieldByName("SomeDateField"));
if (field)
field->DisplayFormat = "yyyy/mm/dd";
HTH,
- Clayton
Re: Why have I got wrong record from this table?
Author: Clayton Arends
Date: Thu, 02 Nov 2006 17:23
Date: Thu, 02 Nov 2006 17:23
17 lines
1748 bytes
1748 bytes
When I first read your second message it appeared to me that you accidentally replied to your own message. However, I just read it again and saw that you changed a 31 to a 30. For future reference, when you are correcting something you wrote please make it obvious. For instance: I mistyped the bad date. It should have been "2006-11-20 12:12:30". This would make it apparent why the second post exists. However, to answer your question. It could be a floating point rounding error though I've never seen that happen to a TDateTime before without some sort of arithmetic involved. I'll keep my eyes open to try to find out what the issue is. Hopefully someone else that knows what's going on will respond. - Clayton
Re: Why have I got wrong record from this table?
Author: ht
Date: Fri, 03 Nov 2006 07:28
Date: Fri, 03 Nov 2006 07:28
25 lines
2263 bytes
2263 bytes
"Clayton Arends" <nospam_claytonarends@hotmail.com> д����Ϣ����:454a2986$1@newsgroups.borland.com... > When I first read your second message it appeared to me that you > accidentally replied to your own message. However, I just read it again > and saw that you changed a 31 to a 30. For future reference, when you are > correcting something you wrote please make it obvious. For instance: > > I mistyped the bad date. It should have been "2006-11-20 12:12:30". > > This would make it apparent why the second post exists. > > However, to answer your question. It could be a floating point rounding > error though I've never seen that happen to a TDateTime before without > some sort of arithmetic involved. > > I'll keep my eyes open to try to find out what the issue is. Hopefully > someone else that knows what's going on will respond. > > - Clayton > Thank you,Clayton!I have seen my program again,I thought maybe you are right.Because the DateTime was reprented as a float value in the access,and In my application I put data into the table every 200ms, perhaps the difference was the different convertion method between Borland and Microsoft.so you are right:It could be a floating point rounding .
Re: Why have I got wrong record from this table?
Author: Erol Fornoles
Date: Thu, 23 Nov 2006 04:05
Date: Thu, 23 Nov 2006 04:05
25 lines
2059 bytes
2059 bytes
I experienced something similar to this one, when I was migrating
DateTime values from an MS Access db to MySQL using TADOQuery. My code
looked something like this:
while (!adoAccess->Eof)
{
adoMySQL->Append();
adoMySQLDT->Value = adoAccessDT->Value;
adoMySQL->Post();
adoAccess->Next();
}
When I inspected the migrated records on MySQL, I found out that most
of the records were off by a second. But if I do this:
adoMySQLDT->Value = StrToDateTime(DateTimeToStr(adoAccessDT->Value));
The resulting records are correct.
Another baffling thing is prior to this one, I had no problem migrating
DateTime values from Interbase/Firebird (using DBX) to MySQL (using
ADO).
- Erol
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