Subject Pulling my hair out: ParamByName stopped working
Author mitch_landor
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

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)
)