TDateTime & TMyQuery

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
kenny
Posts: 43
Joined: Mon 15 Nov 2004 08:48
Location: Malaysia
Contact:

TDateTime & TMyQuery

Post by kenny » Mon 15 Nov 2004 11:07

Hi, I'm using MyDac v3.3

This is my query
SELECT
Min(SystemDate) AS MinOfSystemDate,
MonthEnd,
MonthEndProcess
FROM SystemCalendar
GROUP BY MonthEnd, MonthEndProcess
HAVING MonthEnd=1 AND SystemCalendar.MonthEndProcess=0;

The SystemDate Datatype is Date
When I attempt to assign to TDateTime variable,

datSystemDate := QMySystemDate.Fieldbyname('MinOfSystemDate').value;

it occurred error: 'Invalid variant type conversion'. How to resolve this problem? THANKS! :cry:

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Re: TDateTime & TMyQuery

Post by Ikar » Mon 15 Nov 2004 16:10

Try to apply to this field not as Variant, but, for example as AsInteger.

kenny
Posts: 43
Joined: Mon 15 Nov 2004 08:48
Location: Malaysia
Contact:

Post by kenny » Mon 15 Nov 2004 16:43

yes, i had tried it by using
datSystemDate := QMySystemDate.Fieldbyname('MinOfSystemDate').AsDateTime;

(the datSystemDate i declared as datSystemDate : TDateTime;)
but same error occurred.

Anyway, i had resolved this by create my own standard function to convert the statement. Thanks!

Post Reply