Subject | Re: [IBO] Pulling my hair out: ParamByName stopped working |
---|---|
Author | mitch_landor |
Post date | 2006-11-21T13:32:03Z |
--- In IBObjects@yahoogroups.com, "Alan McDonald" <alan@...> wrote:
Mitch
>us the
> > I'd be grateful for any assistance with this which is driving me nuts.
> >
> > This procedure calls a query which successfully returns all rows if I
> > comment out the ParamByName line in the procedure and the parameter in
> > the query.
> >
> > If I remove the commenting out, zero rows are returned, even though
> > the variable "curr_proj_version" is correctly set and there are
> > definitely rows in the table that match. I can manually enter the
> > chosen value for "curr_proj_version" in the query and open the dataset
> > and get the required rows.
> >
> > Any ideas why this might not be working?
> >
> > Thanks
> >
> > Mitch
>
> there could be many reasons why this doesn't work. you need to show
> table definition as well as the value you are assiging to the parameter.pversion_id
> But mainly I suspect that it is because you are not aliasing the
> field when assigning the parameter and this field is also in one ormore of
> the other tables.earlier
> If you are using FB2 then this ambiguity would not be tolerated but
> versions will accept it and provide unexpectd results if no aliasing isThanks Alan for your help. What exactly do you mean by aliasing?
> done.
> Alan
>
Mitch
> >
> > procedure TfrmProjectContainer.SpecificationsTabShow(Sender: TObject);
> > begin
> > with DataModule5 do
> > begin
> > if not IBODatabase1.Connected then
> > IBODatabase1.Connect;
> >
> > if qryCurrProjSpecs.Active then
> > qryCurrProjSpecs.Unprepare;
> > qryCurrProjSpecs.prepare;
> > with qryCurrProjSpecs do
> > ParamByName('Var_PVERSION_ID').asinteger := curr_proj_version;
> > qryCurrProjSpecs.Open;
> > end;
> > end;
> >
> >
> > =====
> > qryCurrProjSpecs:
> >
> > select
> > spec.spec_id,
> > spec.pversion_id,
> > spec.spec_descr,
> > spec.supplier_ref,
> > spec.unitcost_est,
> > spec.unitcost_act,
> > spec.approved,
> > spec.unitdelivcost,
> > spec.act_leadtime,
> > spec.est_leadtime,
> > spec.spec_active,
> > spectype.name_eng spectype_name,
> > spec.specattr_fabric_id,
> > spec.specattr_misc_id,
> > spec.specattr_elec_id,
> > uom.code uomcode,
> > party.shortname supplier_shortname,
> > spec.spectype_id
> > from spec
> > inner join spectype on (spec.spectype_id = spectype.spectype_id)
> > inner join uom on (spec.uom_id = uom.uom_id)
> > inner join party on (spec.supplier_id = party.party_id)
> >
> > where
> > (
> > (pversion_id = :var_PVERSION_ID)
> > )
> >
>