Subject | Re: [firebird-support] FB 2.1 - ClientDataset Date Param - SQL error code = -303 |
---|---|
Author | Teträm Corp |
Post date | 2008-07-07T08:25:51Z |
hi,
they are not:
from
((fac_com.id_proveedor = :id_proveedor) or (:id_proveedor = -1)) and
(fac_com.fecha between :FechaDesde and :FechaHasta)
even if it's the same name, each one use an index position.
so you must use ParamByName
cdsDatos.ParamByName('id_proveedor').AsInteger := -1;
cdsDatos.ParamByName('FechaDesde').AsDate := EncodeDate(2000,1,1);
cdsDatos.ParamByName('FechaHasta').AsDate := EncodeDate(2010,1,1);
or
cdsDatos.Params[0].AsInteger := -1;
cdsDatos.Params[1].AsInteger := -1;
cdsDatos.Params[2].AsDate := EncodeDate(2000,1,1);
cdsDatos.Params[3].AsDate := EncodeDate(2010,1,1);
Thierry
Anderson Farias a écrit :
they are not:
from
((fac_com.id_proveedor = :id_proveedor) or (:id_proveedor = -1)) and
(fac_com.fecha between :FechaDesde and :FechaHasta)
even if it's the same name, each one use an index position.
so you must use ParamByName
cdsDatos.ParamByName('id_proveedor').AsInteger := -1;
cdsDatos.ParamByName('FechaDesde').AsDate := EncodeDate(2000,1,1);
cdsDatos.ParamByName('FechaHasta').AsDate := EncodeDate(2010,1,1);
or
cdsDatos.Params[0].AsInteger := -1;
cdsDatos.Params[1].AsInteger := -1;
cdsDatos.Params[2].AsDate := EncodeDate(2000,1,1);
cdsDatos.Params[3].AsDate := EncodeDate(2010,1,1);
Thierry
Anderson Farias a écrit :
>
> Hi,
>
> > cdsDatos.Params[0].AsInteger := -1;
> > cdsDatos.Params[1].AsDate := EncodeDate(2000,1,1);
> > cdsDatos.Params[2].AsDate := EncodeDate(2010,1,1);
>
> Are you sure your date params (FechaDesde and FechaHasta) are indexed
> 1 and
> 2 in your CDS params property?
>
> Regards,
> Anderson Farias
>
>