Subject RE: [IBO] Dates in TIBOQuery vs. PrepareSQL
Author Alan McDonald
> --- In IBObjects@yahoogroups.com, "Alan McDonald" <alan@m...> wrote:
> >
> > > Hi All,
> > >
> > > Somewhat confused. If I enter:
> > >
> > > Where (Reading_Time > (Cast('2005/10/05' As Date)))
> > >
> > > into a TIBO Query then I get the anticipated result.
> > >
> > > However if I add:
> > >
> > > SQLWhereItems.Add('(Reading_Time > (Cast('2005/10/05' As
> Date)))');
> >
> > try
> > SQLWhereItems.Add('(Reading_Time > (Cast(''2005/10/05'' As
> Date)))');
> >
> Thanks for the reply Alan.
> Have tried your suggestion. The program compiles and starts running
> but then get the message "Column Unknown 2005/10/05" from IBO.
> Any more suggestions?
> Suppose I should add that the Reading_Time field is a Timestamp but
> read somewhere that the Date/Timestamp conversions are "OK" so doubt
> that is the problem (anyway it runs in the SQL for the query OK).

you would get "column unknown" if you put double quotes around the date - I
want you to put 2 single quotes.
i.e. NOT "
but ''

Alan

> >
> > > to the same query OnPrepareSQL I get the message:
> > >
> > > [Error] DM_Unit.pas(74): Incompatible types: 'String'
> and 'Extended'
> > >
> > > BTW, I'm using Delphi 5 Pro.
> > > Any suggestions or references to handling dates with TIBO?
> > >
> > > Regards,
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> __________________________________________________________________
> > > _________
> > > IB Objects - direct, complete, custom connectivity to Firebird
> or
> > > InterBase
> > > without the need for BDE, ODBC or any other layer.
> > >
> __________________________________________________________________
> > > _________
> > > http://www.ibobjects.com - your IBO community resource for Tech
> > > Info papers,
> > > keyword-searchable FAQ, community code contributions and
> more !
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
>
>
>
>
>
>
>
> __________________________________________________________________
> _________
> IB Objects - direct, complete, custom connectivity to Firebird or
> InterBase
> without the need for BDE, ODBC or any other layer.
> __________________________________________________________________
> _________
> http://www.ibobjects.com - your IBO community resource for Tech
> Info papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>