Subject Re: [firebird-support] Re: Time Field: Trouble updateing in FB 2.1 from Delphi 2007
Author Alfonso Presa
Hi Homer, nice to hear from you again, I have not try it now but I'm pretty sure I have done this in the pass. It depends on the way IBDac deals with variants and timestamp because you are using an implicit casting. In that case you should use encodedatetime or encodetime, you can find it in the help.



De: homerjones1941 <homer@...>
Enviado: Domingo, enero 15, 2012 9:10 P.M.
Asunto: [firebird-support] Re: Time Field: Trouble updateing in FB 2.1 from Delphi 2007


--- In, Helen Borrie <helebor@...> wrote:
> At 05:19 PM 16/01/2012, homerjones1941 wrote:
> >I've searched past posts, but haven't been able to find solution.
> >
> >I have a Time FieldType in a FB 2.1 DB and have been unable to insert a time value into that field. I've tried the following (Note: I've resulted to hard coding the values to eliminate possible formatting issues caused by me):
> >
> > FieldByName('AlarmTime').Value := '4:30:00 PM';
> > FieldByName('AlarmTime').Value := '11:30:00 PM';
> Not a valid TIME literal. The format uses the 24-hr clock and takes the form
> hh:nn:ss.nnnn or hh:nn:ss.nnn
> If you don't care about sub-seconds, use zeroes there.
> >Error message is '0.0 is not a valid Timestamp.'
> If you are absolutely sure that column is TIME and not TIMESTAMP then I would guess you are using the (broken) old BDE. The last-ever was v.5.2 and the Dialect 3 date/time support still didn't work properly.
> >If I omit the "PM" the error message is similar.
> > FieldByName('AlarmTime').Value := '4:30:00';
> It's a gamble assigning any date or time values to the Value property of a VCL parameter but in this case it's obviously not working because your interface (whatever it is) doesn't recognise that as time literal. If you want to persevere, I suggest you try one of the following:
> FieldByName('AlarmTime').Value := QuotedStr ('04:30:00');
> FieldByName('AlarmTime').Value := ''04:30:00''; // doubled apostrophes NOT double quotes
> >Error Message is '693594. -1073258496 is not a valid Timestamp.'
> And that's not a valid Firebird message, either.
> >I've tried using TDateTime values with similar results.
> Using AsDateTime???
> ./heLen

Wow. Thanks for the quick response. I tried the "QuotedStr" solution but got yet another error: 'Could not convert variant of type (String) into type (Date).'

I try to stay as far away from BDE as possible. I'm using IBDac components (the latest Devart stuff).

I haven't tried to create an "INSERT INTO" query, but that's next. Perhaps DSQL will handle the time field properly.

[Non-text portions of this message have been removed]