Subject | Re: [IBO] Invalid variant operation |
---|---|
Author | Helen Borrie |
Post date | 2004-01-19T10:15:30Z |
At 09:46 AM 19/01/2004 +0000, you wrote:
parameters. You're getting this invalid variant error because the
parameter is null (being unassigned.)
always have to assign values to the parameters before opening the query.
If you want "master-detail" behaviour, you have to assign the detail's
Datasource property to the master query's datasource. Did you remember to
do that?
But, hint, if your detail's linking key has the same name as the master's
primary key, you don't have to worry about using the parameter at all -
leave it out - IBO takes care of that.
Of course you need correct KeyLinks in both sets, too.
Helen
> >Yes, of course. I hadn't even considered that you had unassigned
> > Yes, look at all your ParamByName, Params, FieldByName and Fields
> > references, where you use the ".Value" method and replace any
>problem ones
> > with ".AsWhatever", i.e. explicit casting.
>
>See I have just made a little test appl.
>In this I have only two TIBOQuerys.
>Then first does:
>
>Select * from Farver;
>
>
>The second does:
>
>Select * from Farver_Detail where Navn = :Navn;
>
>In my program is do this on FormShow:
>
> IBODatabase1.Open;
> IBOquery1.Open;
> IBOquery2.Open;
>
>
>When opening the second I get the above error.
parameters. You're getting this invalid variant error because the
parameter is null (being unassigned.)
>If I instead does this on OnDataChange on the first TIBOQuerysIt should be in the BeforeOpen event of the query itself.
>datasource it works:
>
> IBOQuery2.Close;
> IBOQuery2.ParamByName('Navn').AsString := IBOQuery1.FieldByName
>('Navn').AsString;
> IBOQuery2.OPen;
>Is this the way I should go, or can I do something to make IBO behaveAFAIK, that's how parameterised queries work in the VCL as well. You
>the same way as standard TQuery comp ?
always have to assign values to the parameters before opening the query.
If you want "master-detail" behaviour, you have to assign the detail's
Datasource property to the master query's datasource. Did you remember to
do that?
But, hint, if your detail's linking key has the same name as the master's
primary key, you don't have to worry about using the parameter at all -
leave it out - IBO takes care of that.
Of course you need correct KeyLinks in both sets, too.
Helen