Subject Re: Cant Insert DateTime to TimeStamp Field (FireBird)
Author Adam
--- In firebird-support@yahoogroups.com, "dilish_tv" <dilish_tv@y...>
wrote:
>
>
> Thanks For the Quick Reply
>
> Error Message is :
>
> Arguments are of Wrong Type or out of Acceptable range or Are Conflict
> with One Another.
>
> ---------------------
> Here is the Code:-
>
> AdoQry.Parameters.ParamByName('Prm0').DataType:= ftTimeStamp;
> AdoQry.Parameters.ParamByName('Prm0').Value :=
> VarToDateTime(RSt.Fields['S_DATE'].Value);
> ---------------------
> RSt.Fields['S_DATE'] is a DateTime Field in MSAccess

Where does the exception get raised? If it is when you are assigning
the parameters, it is a Delphi exception, you could try something like.

AdoQry.Parameters.ParamByName('Prm0').AsDateTime :=
RSt.FieldByName('S_DATE').AsDateTime;

Of course if the field contained any NULLs, then those records would
be given a date (1899 or 1758 or something like that) when you call
.AsDateTime.

so you could do something like

if RSt.FieldByName('S_DATE').IsNull then
AdoQry.Parameters.ParamByName('Prm0').Clear
else AdoQry.Parameters.ParamByName('Prm0').AsDateTime :=
RSt.FieldByName('S_DATE').AsDateTime;

And see if that helps.

Delphi implements timestamps/datetimes as a floating point number, so
it is impossible to get the MySQLish scenario of 30 Feb or some other
impossible date, I am not sure is Access also happily stores illegal
dates.

Adam