MyDAC or VCL Bug ?

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

MyDAC or VCL Bug ?

Post by swierzbicki » Tue 10 Oct 2006 13:02

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

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

Post by Antaeus » Tue 10 Oct 2006 15:02

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

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

Post by swierzbicki » Wed 11 Oct 2006 09:34

Thank you for this explaination

Post Reply