'0.0' is not a valid timestamp.

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

'0.0' is not a valid timestamp.

Post by oz8hp » Sat 08 Jan 2011 20:16

I have a small application running with an MS Access DB witout problems
Now I try to upgrade to MySQL using the folowing script for table.
When opening my form with datagrid I get an error saying '0.0' is not a valid timestamp.
Where would I have to look to figure this out?
I have spend hours trying to figure out what could be wrong.

CREATE TABLE `tblsalary` (
`fldsalary_guid` varchar(50) NOT NULL,
`fldsalary_debit` double default '0',
`fldsalary_kredit` double default '0',
`fldsalary_saldo` double default '0',
`fldsalary_text` varchar(50) default NULL,
`fldsalary_user` varchar(50) default NULL,
`fldsalary_computer` varchar(50) default NULL,
`fldsalary_date` date default NULL,
`fldtimestamp` datetime default NULL,
PRIMARY KEY (`fldsalary_guid`),
UNIQUE KEY `fldsalary_guid` (`fldsalary_guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Post by oz8hp » Sun 09 Jan 2011 10:59

I changed the field fldsalary_date from type DATE to type DATETIME and the error is gone.
Should it not be possible to have a field with just the date and no time?

AndreyZ

Post by AndreyZ » Tue 11 Jan 2011 08:46

Hello,

I cannot reproduce the problem. Please try composing a small sample to demonstrate the problem and send it to andreyz*devart.com, including a script to create and fill a table.

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Post by oz8hp » Wed 12 Jan 2011 07:47

I have mailed you a small sample that has the error I talk about.

If I change the field fldsalary_date to DATETIME the error goes away


Please note that much of the code is from a larger app so there might be something commented out.

AndreyZ

Post by AndreyZ » Thu 13 Jan 2011 13:56

We have answered you by e-mail.

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Post by oz8hp » Thu 13 Jan 2011 18:13

The suggested solution works but I would like to have some of the fields formated #,##0.00 and that I can't do on the grid.

AndreyZ

Post by AndreyZ » Fri 14 Jan 2011 08:36

The problem was that you created TDateTimeField for the date data type. If you remove all constant fields (using Fields Editor) from the TUniQuery component and add them again, you will see that UniDAC creates TDateField for date data types. After this you can set formatting of the fields that you want.

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Post by oz8hp » Fri 14 Jan 2011 09:16

OK - now I think I have got it.

Thank you very much for the help.

AndreyZ

Post by AndreyZ » Fri 14 Jan 2011 09:37

It is good to see that this problem was solved. Feel free to contact us if you have any further questions about UniDAC.

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Post by oz8hp » Sat 15 Jan 2011 13:30

I was to quick here - when I switch back to MS Access the problem is there again.
My users will have to be able to select the database they want to use because some of them have no MySQL available.

So I will go back to defining the field as datetime on MySQL - that works.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 17 Jan 2011 08:45

Hello,

As MS Access supports only the DateTime field type, you should use DateTime fields in MySQL as well to be able to use the same components for both databases without changing field types.

Post Reply