delphi - '0.0' is not a valid timestamp when accessing OldValue of TClientDataSet's TDateField -
When I use the following code in a new inserted record in a TClientDataSet:
CdsMyDateField Old Value & lt; & Gt; Zero I get an error message:
'0.0' is not a valid timestamp ' Delphi Looking at the VCL's code, TDateTime tries to change this value, which results in an exception as the value (tap) is an invalid date time, but as I compare the variants I The type will return, which will be tapped in this case, but it does not happen, its Instead I get this exception.
I know that I can only check whether before DataSet.State = dsInsert values compare, like state = every old current has a tap, but I have to understand that the old value is only all Rather than returning the taps in the fields why try to change the value when state = DSINRST
Anyone give me some light?
FWI, I have participated in this problem and this gave me reason many headaches My opinion: Incompatible behavior So, because of this reason alone I class it as a bug. This is also a bug because the IMHO is a ridiculous exception to reading an asset and does not keep with the intent of properties (at least with the theory of surprises). I hope the old man should be assigned, did not take exception to reading (besides, the fact that some issues exist for a long time or not, whether it is a bug or not, does not show anything about it .)
(Edit: Updating my answer with more information, along with our solution, has been posted on QC report besides :)
< P> This was the only problem in the app Micro heavy use Detanet / Claintdetsets. Although the actual problem is not with the client data set, but with the timestamp verification assignment in SysUtils, it apparently incorrectly validates a timestamp with 0.0 values as invalid.Therefore workaround / fix is therefore for SysUtils and validation routine, and not specifically, in the validity rule "ValidateTimeStamp ()", the time portion is properly compiled & lt; 0 but the date part is erroneously compared & lt; = 0.
As a result, a (valid) 0.0 time time value is sometimes converted to a timestamp with datepart = 0, and when this value is re-verified (such as when data The dataset is read from the field as shown here and in the QC report), an exception (by mistake) has been raised so to change the recognition for the date part of the timestamp, to make them easy to use, the strict TClientDataset Door This was a solution to the highlighted problem.
Here our workaround is based on Delphi 7.1
(* SysUtils.pas line 10934 (Delphi 7.1) *) (**) (* OK - Timestamp value 0.0 Wrongly named as invalid) * (* D7.1 *) (* Walter Prince, originally settled in May 2005, submitted on June 4, 2009 *) Process Validated DataTump (Conf. Timestamp: TTEMSTAMP) ); (TimeStamp.Date & lt; = 0 TimeStamp.Date & lt; 0 *) ConvertErrorFmt (@SInvalidTimeStamp); , [TimeStamp.Date, Timestamp .Phil.]); End;
Comments
Post a Comment