Page 1 of 1

'0.0' is not a valid timestamp.

Posted: Sat 08 Jan 2011 20:16
by oz8hp
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;

Posted: Sun 09 Jan 2011 10:59
by oz8hp
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?

Posted: Tue 11 Jan 2011 08:46
by AndreyZ
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.

Posted: Wed 12 Jan 2011 07:47
by oz8hp
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.

Posted: Thu 13 Jan 2011 13:56
by AndreyZ
We have answered you by e-mail.

Posted: Thu 13 Jan 2011 18:13
by oz8hp
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.

Posted: Fri 14 Jan 2011 08:36
by AndreyZ
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.

Posted: Fri 14 Jan 2011 09:16
by oz8hp
OK - now I think I have got it.

Thank you very much for the help.

Posted: Fri 14 Jan 2011 09:37
by AndreyZ
It is good to see that this problem was solved. Feel free to contact us if you have any further questions about UniDAC.

Posted: Sat 15 Jan 2011 13:30
by oz8hp
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.

Posted: Mon 17 Jan 2011 08:45
by AlexP
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.