EConvertError
Posted: Fri 18 Oct 2013 13:48
I am running the same Delphi 2007 code on two Windows 7 machines using an SQL server database on a remote server. When I run the code one one machine it crashes on the following line: aQuery.FieldByName('curr_date').asDateTime with an 'EConvertError: 2013-10-18 00:00:00.000 is not a valid date and time' but on the other machine the code runs without any issues. The 'curr_date' field is a Datetime2 datatype. I found that if I check the value of the 'curr_date' as a string (i.e. aQuery.FieldByName('curr_date').asString), on one machine the date is formatted as '1/25/2013' and on the other machine the date is formatted as '2013-1-25 00:00:00.000'. The machine on which the date is formatted as '2013-1-25 00:00:00.000' is the machine on which the code crashes. The regional settings in Control Panel are identical on both machines. Note that I am using TUniConnection and TUniQuery objects.