|Subject||[IBO] Re: Dynamic Master Detail SQL|
>Don't you have Nil in C++? "NULL" doesn't look right to me, at leastfrom the POV of ObjectPascal....Nil means "nothing assigned". NULL
means something different to me...
NULL expands to an int zero or a long zero. Unused pointers are
normally zeroed. There is no Nil that I know of.
> Do your controls know that they have to link through a differentdatasource?
Not sure what you mean here....my 2 grids stay linked to DataSource1
and DataSource2..... it's only the DataSource property of IBOQuery2
that we're playing with.....
I'm using TDBGrids, TDataSources, and TIBOQuerys, in case that wasn't
clear. IBO V4.3Ab & BCBuilder5...was trying to avoid upgrading and
having to fix everything again :)
I've just tried it in Delphi 7 using some of your code and get exactly
the same result (and error message) using...
procedure TForm1.Button1Click(Sender: TObject);
if IBOQuery2.Active then
IBOQuery2.SQL.Clear; // this causes Unprepare
IBOQuery2.Datasource := Nil; // ESSENTIAL!!
if IBOQuery1.Active then
IBOQuery1.SQL.Clear; // this causes Unprepare
// Now we are clean so we set up the new structure
IBOQuery1.Sql.Add('select CAT2NO,CAT1NO,CAT2 from CATEGORY2 where
CAT1NO < 200');
IBOQuery2.Sql.Add('select CAT3 from CATEGORY3 where CAT2NO=:CAT2NO');
IBOQuery2.Datasource := DataSource1;
// No need to call Prepare, as Open calls it
// Include some try..except protection here
Does it work for you?