Subject | invalid date value raises exception |
---|---|
Author | eddressel |
Post date | 2009-02-21T01:16:47Z |
I have a field in a database that has an invalid date and raises an
exception with the following message:
'-6406.0' is not a valid timestamp
I don't know how to get around this. I tried the following code:
lField := Dataset.FieldByName('DOB');
if lField.AsFloat < 0 then
begin
//Assert(lField.Dataset.OnCalcFields = qryPersonCalcFields);
lField.Dataset.OnCalcFields := nil;
try
SetFloatValue(lField, EncodeDate(1960, 1, 1));
finally
lField.Dataset.OnCalcFields := qryPersonCalcFields;
end;
end;
but in the .AsFloat property the .AsDateTime property is called, and
it raises the exception.
Is there anyway I can check the data to see if it is valid, avoiding
the exception?
Thank you,
Ed Dressel
exception with the following message:
'-6406.0' is not a valid timestamp
I don't know how to get around this. I tried the following code:
lField := Dataset.FieldByName('DOB');
if lField.AsFloat < 0 then
begin
//Assert(lField.Dataset.OnCalcFields = qryPersonCalcFields);
lField.Dataset.OnCalcFields := nil;
try
SetFloatValue(lField, EncodeDate(1960, 1, 1));
finally
lField.Dataset.OnCalcFields := qryPersonCalcFields;
end;
end;
but in the .AsFloat property the .AsDateTime property is called, and
it raises the exception.
Is there anyway I can check the data to see if it is valid, avoiding
the exception?
Thank you,
Ed Dressel