TCRBatchMove EConvertError: '' is not a valid date and time

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

TCRBatchMove EConvertError: '' is not a valid date and time

Post by swierzbicki » Tue 17 Jul 2007 14:28

Hi,

I'm getting an EConvertError when my source dataset has date time fields filled with null values.

To bypass this probelm, I have replaced the above code
ftDate, ftTime, ftDateTime:
DestField.AsDateTime := SrcField.AsDateTime;
with
ftDate, ftTime, ftDateTime:
if vartostr(SrcField.value) '' then DestField.AsDateTime := SrcField.AsDateTime;
This is not really clean, but it is working

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 18 Jul 2007 13:01

It looks strange, as this operatop should not be performed because of this condition above in the code:

Code: Select all

    if SrcField.IsNull then
      DestField.Clear
    else
       
Please check if you changed source code of the CRBatchMove.pas unit.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 18 Jul 2007 13:01

It looks strange, as this operatop should not be performed because of this condition above in the code:

Code: Select all

    if SrcField.IsNull then
      DestField.Clear
    else
       
1105;Please check if you changed source code of the CRBatchMove.pas unit.

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by swierzbicki » Thu 19 Jul 2007 10:04

Hi,

Well, that's weird, the field value isn't null but '' (empty string !!!)
I'm transfering datas from an Advantage Database Server to an MySQL Serveur.

The above code is allready here.
if SrcField.IsNull then
DestField.Clear
else

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 27 Jul 2007 08:50

It is unlikely that we will apply similar change to the TCRBatchMove code, as it looks like an Advantage server issue. Probably a better solution is to replace wrong values using a calculated field (on the server or on the client) instead of the actual field.

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by swierzbicki » Fri 27 Jul 2007 13:00

That's a good idea. I will test the DateTime field in the SQL query so that no empty values will be retreived.

Thank you for this tip

Post Reply