Howdy!
If a dataset's TDate/TTime fields are set NULL fields and a TVirtualQuery statement is executed against the dataset, the untouched TDate/TTime NULL fields are set to 0 instead of setting the field's Variant value as NULL (Null()). Setting a TDate/TTime field to just 0 when it was a NULL value from the underlying source dataset causes the TField's IsNull property to return false instead of true and values in data-aware controls are shown as 12/30/1899 (Delphi NULL default value).
All the best,
Aggie85
TVirtualQuery Bug With NULL TDateTime Fields
Re: TVirtualQuery Bug With NULL TDateTime Fields
Thank you for the message. Please explain which query you are executing when you get the described behavior. For this, compose and send us a small sample using the e-support form (https://www.devart.com - the "Support"\"Request Support" menu).
Re: TVirtualQuery Bug With NULL TDateTime Fields
Howdy Maxim!
I will put together a small demo to illustrate the bug.
Since I had to get my beta out, I just wrote my own wrapper class around TVirtualQuery that essentially replaced all source data sets BeforePost() events with a local one that checks all TDate/TTime fields with a value of 0. If the values are 0, I set the value to Null() which keeps the field's IsNull() method to True and then I call the previous BeforeEvent() for the dataset if there is one.
My solution adds very little overhead and allows me to fix these type of things quickly with no delay.
Have a great weekend,
Aggie85
I will put together a small demo to illustrate the bug.
Since I had to get my beta out, I just wrote my own wrapper class around TVirtualQuery that essentially replaced all source data sets BeforePost() events with a local one that checks all TDate/TTime fields with a value of 0. If the values are 0, I set the value to Null() which keeps the field's IsNull() method to True and then I call the previous BeforeEvent() for the dataset if there is one.
My solution adds very little overhead and allows me to fix these type of things quickly with no delay.
Have a great weekend,
Aggie85