date format in query result (SQL-Server)
Posted: Sat 27 Apr 2013 06:48
Hi,
I'm migrating a Delphi projet from Oracle to MS SQL-Server, using UNIDAC...
I have a problem querying date fields : when I try to assign the field value of a date returned by the query to a TDateTime variable, .FieldByName('date_field').AsDateTime throws an exception (cannot convert unicode string to double).
My code :
d := UniQuerySelectPatient.FieldByName('date_naissance').AsDateTime;
where d is a TDate, and column date_naissance is of type datetime2(0)
nb : inspecting UniQuerySelectPatient.FieldByName('date_naissance').Value gives '1920-01-31 00:00:00'
how can I ensure that the returned fiel (in this case .FieldByName('date_naissance')) is of date (datetime) type ?
(I don't want to change the source code of my Delphi project, as I'd like to be able to access both Oracle and SQL-Server with the same code)
Thanks for any help...
Attila
I'm migrating a Delphi projet from Oracle to MS SQL-Server, using UNIDAC...
I have a problem querying date fields : when I try to assign the field value of a date returned by the query to a TDateTime variable, .FieldByName('date_field').AsDateTime throws an exception (cannot convert unicode string to double).
My code :
d := UniQuerySelectPatient.FieldByName('date_naissance').AsDateTime;
where d is a TDate, and column date_naissance is of type datetime2(0)
nb : inspecting UniQuerySelectPatient.FieldByName('date_naissance').Value gives '1920-01-31 00:00:00'
how can I ensure that the returned fiel (in this case .FieldByName('date_naissance')) is of date (datetime) type ?
(I don't want to change the source code of my Delphi project, as I'd like to be able to access both Oracle and SQL-Server with the same code)
Thanks for any help...
Attila