Subject [IBO] Re: Dynamic Master Detail SQL
Author sdbeames
> >NULL expands to an int zero or a long zero. Unused pointers are
> >normally zeroed. There is no Nil that I know of.
>
> Try it. It's Delphi for "unassigned object".

Tried it again....does not compute with any combination of
capitalisation.... Using Nil in D7 didn't help the problem either.

> > > Do your controls know that they have to link through a different
> >datasource?
> >
> >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.....

AND the SQL of both queries of course.

> The TDatasource provides datalinking between a dataset and
> controls. How can it be that you mess around with the datasets and
> don't touch the datasources?

You must be saying something different to what I'm hearing here.
Can't you change the query's SQL and leave the DataSource property
alone? But anyway, I've been zeroing the Detail Query's DataSource
property, then resetting it after the SQL was changed. The problem
seems to be that the detail query is remembering the fields from the
first SQL query it executed, and then complaining when it can't fetch
them anymore because the master query SQL has changed, but only after
choosing a different master record. Is there another step needed to
clear the detail query's parameter list?

> The detail dataset's Datasource
> property has to point to the TDatasource that provides the
> datalinking for the master dataset.

Yes, it always have been, except when I set it to zero before changing
the SQL, then it was reset to the same master DataSource as before.

> Another thing you might not have thought about is the persistent
> Fields[] objects...do you materialise those (TFields etc.) in your
> IDE? If so, your code will have to get rid of them as well....that
> alone could account for a large part of your problems.

Nah, no persistent fields setup. Very minimal test program.

Starting to look like I'll have to dynamically create & destroy the
queries to get it to work. Just seems odd though....

I presume that if you've tried it, you would have used a much newer
version of IBO, so maybe that's the difference. Ah well, thanks
anyway. Cheers.