emileverh 22 Posted February 22 Hi team! frmSelectFooter := TfrmSelectFooter.Create(self); if frmSelectFooter.ShowModal = mrOk then begin ... end; FreeAndNil( frmSelectFooter ); If there are TFDQuery's used in that form, do I need to close explicitly close the query? In other words, are (database) resources still in use? Thanks! Emile Share this post Link to post
Tom Chamberlain 47 Posted February 22 Depends where the TFDConnection is defined, are you using a shared data module or creating it in the form? Is it pooled? Share this post Link to post
emileverh 22 Posted February 22 Just now, Tom Chamberlain said: Depends where the TFDConnection is defined, are you using a shared data module or creating it in the form? Is it pooled? The TFDConnection is on a central place in the program on a different datamodule. ( MySQL and the property 'Pooled' is left default, which is False ) Share this post Link to post
PeterBelow 239 Posted February 22 All components that have the form as Owner (which includes all components dropped on the form in the IDE designer) are automatically destroyed when the form is destroyed. So your query components are destroyed but whether that automatically releases serverside resources depends on how the component, especially its destructor, is implemented. But a TFDQuery will close the query when it is destroyed, so your scenario is OK. 1 Share this post Link to post
emileverh 22 Posted February 22 Just now, PeterBelow said: All components that have the form as Owner (which includes all components dropped on the form in the IDE designer) are automatically destroyed when the form is destroyed. So your query components are destroyed but whether that automatically releases serverside resources depends on how the component, especially its destructor, is implemented. But a TFDQuery will close the query when it is destroyed, so your scenario is OK. Thanks for the quick reply!! 😉 Share this post Link to post