Page 1 of 1

AsDate / TDate Field

Posted: Fri 28 Jul 2017 21:47
by OlliWW
Hello,

In Microsoft SQL Server you can declare DateTime and Date Fields.

When using SDAC you can set a Parameter like this way for a date-Field:

Code: Select all

qryExec.Params.ParamByName('StartDate').AsDate
But when you select values from a MS DB with:

Code: Select all

qrySelect.FieldByName('StartDate').As........
you only have "AsDateTime", which results in a cast error, when selecting a Date-Field.
In Delphi you also have "TDate". So it would be nice to have a "AsDate" Funktion also when you are using FieldByName. Is there any way to achieve this?

Re: AsDate / TDate Field

Posted: Mon 31 Jul 2017 07:37
by azyk
The cause of the specified error is not SDAC, but the behavior specificity of the standard TField class. To avoid it, please refer to the following article in Embarcadero documentation: http://docwiki.embarcadero.com/Librarie ... AsDateTime