Page 1 of 1

Read Field Value AsDateTime

Posted: Tue 06 Apr 2010 23:01
by FarshadV
I am connecting to a SQLite3 database with the UniDAC components (ver 3.00.0.7), and when I try to retrieve a column's data which contains Date and Time value I get an error.

My code is:

Code: Select all

TmpDate:= dmECOE.qryGeneral.FieldByName('OrderDate').AsDateTime;
The generated error is:
EConvertError "2010-03-26 00:00:00" is not a valid date and time.
Your help is very much appriciated.

Regards,

Farshad R. Vossoughi

Posted: Wed 07 Apr 2010 13:39
by bork
It seems like the "OrderDate" field does not have the DateTime type in the database. If the "OrderDate" field has string type in the database then you should get this field as FieldByName('OrderDate').AsString and convert to the TDateTime format manually.

Posted: Fri 09 Apr 2010 13:29
by FarshadV
Thank you very much

Best Regards,

Farshad R.Vossoughi