Subject Re: [IBO] IB_Transaction.Datasets[i] and TIBOQuery
Author Helen Borrie
At 08:03 PM 17/10/2007, you wrote:
>If I add a TIBOQuery to a form and set it's IB_Transaction, I see the
>_DatasetCount of the IB_Transaction component increment by 3. (internal sets
>as well as the query itself).
>So if I do this:
>for i:=0 to IB_Transaction1.DatasetCount-1 do begin
> with IB_Transaction1.Datasets[i] do begin
> if (IB_Transaction1.Datasets[i].Name<>'') then begin
> Open;
> end;
> end;
>I was expecting the TIBIOQueries on the form to open as do the TIB_Queries.
>But they don't.
>Can anyone tell me why the dataset count includes them but access to the
>desendent TIBOQuery itself is not possible with this method?

The Datasets property of TIB_Transaction is an array of
TIB_Dataset. TIBOQuery is not a TIB_Dataset descendent, so your loop
won't touch it (though it does touch its InternalDataset, which *is*
a TIB_Dataset). To reach the TDataset-descendent DAOs you'll need to
go through the Components array of the container object, testing for
Components[i]=TIBOQuery and operating on TIBOQuery(Components[i]).