Subject Re: [IBO] Prepared and unprepared
Author Helen Borrie
At 12:24 PM 30/06/2003 +0200, you wrote:
>Thanks Helen.
>
>I had been taught to close all the data access objects when I am finished
>with them, but your advice seems different.
>
>Is this true of all IB data access objects? I mean, for insert, update,
>delete, and select transactions could I do the following :
>
> Screen.Cursor := crSQLWait;
> Screen.ActiveCustomForm.Refresh;
> try
> try
> begin
> with IBQry_GetBatchData do
> begin
> if not IB_Transaction.InTransaction then
> IB_Transaction.StartTransaction;
>
> ParamByName('BATCHNUM').AsInteger := Batch;
> ParamByName('TERMID').AsString := TermID;
>
> if not Active then Open else Refresh;

Not this line. Nothing will happen here if the dataset happens to
be Active.

If you change the parameter values then you need a fresh set. Just call
Refresh after assigning the new params values. IBO will take care of the
InvalidateRows call and will fetch any required rows that aren't in the buffer.

> end;
> end;
> except
> on E : Exception do
> begin
> IBdmMain.HandleException('XYZ');
> raise;
> end;
> end;
> finally
> begin
> Screen.Cursor := crDefault;
> Screen.ActiveCustomForm.Refresh;

Not sure what this would do. The controls linked to the dataset will
have already refreshed themselves before this.

> end;
> end;

Helen