Page 1 of 1

MyDAC or VCL Bug ?

Posted: Tue 10 Oct 2006 13:02
by swierzbicki
Hi,

I just found that at runtime :

Code: Select all

If Query['MyDate'].IsNull then DoSomething();
get an EVariant Invalide OP error with message : Invalid variant operation
while

Code: Select all

If Query.FieldByName('MyDate').IsNull then DoSomething();
worked like a charm !

Is this a VCL bug or a MyDAC bug ?

Ps : MyDate is a TDateTimefield type

Posted: Tue 10 Oct 2006 15:02
by Antaeus
This is not a bug. These lines are not equal because this call

Code: Select all

  Query['MyDate']
returns value of Variant type, but this one

Code: Select all

  Query.FieldByName('MyDate')
returns value of TField type. TField has IsNull method implemented but Variant does not. Following three calls are equal:

Code: Select all

  Query['MyDate']
  Query.FieldValues['DName']
  Query.FieldByName('MyDate').Value

Posted: Wed 11 Oct 2006 09:34
by swierzbicki
Thank you for this explaination