Disposing / Releasing objects
Hello all,
Have a doubt with releasing objects once I am done with them.
Am developing a Windows Forms MDI database application (Oracle as the backend).
I create various DataReader, DataAdapter, DataSet objects in various child forms (where each child form is a "module" in the application). How and when do I release these objects. Will they be destroyed when the window is closed automatically or do I need to say object.dispose or set them = NULL ?
Example.
I have a "Search for Customers" module which the user invokes from a menu item. This window calls a database procedure which returns a resultset using a refcursor type. Then the search results datagrid is populated using the dataset.
Now the Command, DataSet, DataAdapter types etc I have defined to perform the above, are to be released at what point of time ? Do I need to code it myself or will they be released when the window is closed ?
Basically I wish to know what kind of these database related objects I can reuse in all modules and which objects I will need to create for each child window, so that my application memory requirement is optimum.
I understand this is a very basic query, but I am new to DotNet and my concepts are not quite clear. Will appreciate if you can help clear this query.
Thanks in advance,
yamyam
|