EConvertError

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
cat
Posts: 1
Joined: Fri 18 Oct 2013 13:37

EConvertError

Post by cat » 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.

AndreyZ

Re: EConvertError

Post by AndreyZ » Mon 21 Oct 2013 06:10

I cannot reproduce the problem. Please specify the following:
- the regional settings on the computer where the problem occurs;
- the script to create and fill your table;
- the exact version of SDAC. You can learn it from the About sheet of TMSConnection Editor;
- the exact version of your IDE (for example, Delphi 2007 11.0.2902.10471);
- the exact version of SQL Server server and client. You can learn it from the Info sheet of TMSConnection Editor.

Post Reply