AsDate / TDate Field

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 9
Joined: Mon 25 Mar 2013 17:03

AsDate / TDate Field

Post by OlliWW » Fri 28 Jul 2017 21:47


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

But when you select values from a MS DB with:

Code: Select all

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?

Devart Team
Posts: 1000
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: AsDate / TDate Field

Post by azyk » Mon 31 Jul 2017 07:37

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: ... AsDateTime

Post Reply