Subject RE: [IBO] IBO/IB_Query PrepareSQL question - does it fire on formcreation? can I avoid that?
Author Alan McDonald
> hello Helen,
>
> > Don't open datasets until you are ready to have them open.
>
> what is in your opinion the best place to open the datasets?
>
> 1. Form creation (but it seems not to be...:-)
> 2. FormShow
> 3. ???
>
> As a general behaviour, when I have a data-module associated with the
> form, it is usually created before the form and in this case I open the
> datasets in the data-module's OnCreate handler so when the form is
> created the datasets are already open. If I don't have a data-module
> (i.e. data components are on the form) I generally open datasets in the
> OnCreate handler.
>
> Cheers
> Salvatore
>

there's no one best place for it. It depends totally on your application
logic and the need (if any) for managing the available resources.
OnShow fires every time your form shows. You don't need to open the dataset
there. Some forms use the dataset solely for their use and you can close it
on form close as well. Other datasets need to be open on datamodule create
since they are used throughout the applciation execution.
Alan