Subject | Re: [IBO] Conversion error, when using locate on a datetime field in D2009 |
---|---|
Author | Andreas Hesse |
Post date | 2009-08-29T16:57Z |
Hello Adrian,
I can reproduce this problem.
But it is more a delphi problem for variant conversions.
TDateTime is a double and a normal DateTime-String can not be
converted to a double.
It would be better, if the Setter would treat DateTime-Fields special
in the SetAsVariant() method.
@Jason: should we implement special handling for datetime srings?
For now, the only workaround is to convert the DateTime-String to
TDateTime value before using Locate.
--
Andreas
I can reproduce this problem.
But it is more a delphi problem for variant conversions.
TDateTime is a double and a normal DateTime-String can not be
converted to a double.
It would be better, if the Setter would treat DateTime-Fields special
in the SetAsVariant() method.
@Jason: should we implement special handling for datetime srings?
For now, the only workaround is to convert the DateTime-String to
TDateTime value before using Locate.
--
Andreas
> Hello Jason,
>
> I'm getting a EvariantTypeCastError: 'Could not convert variant of type (UnicodeString) into type (Double), when using locate.
>
> The error is thrown in IB_Components.TIB_Column.SetAsVariant()
>
> See image attached: Conversion Error.jpg
>
> The Call Stack, has been included, see Conversion Error_Call Stack.jpg
>
> The offending line of code in my application:
> IF DM.IB_QuerySubWEIGHTS.Locate('WEIGHTDATE',ConvertWLDTtoDelphiDT(FieldList.Items[1]),[])then //check if DateTime for Animal exists
>
> ConvertWLDTtoDelphiDT simply correctly parses a WindowsMobile device DateTimeStamp:
> The actual string passed = '2008/09/28 20:18:20'
>
> Regards
>
> Adrian Wreyford
>