ADO.NET Cleanup

  • Thread starter Thread starter Tom Archer
  • Start date Start date
T

Tom Archer

Besides closing the connection, is there any other cleanup
I should be doing for the adapter, dataset, datatable and
commandbuilder objects upon application exit?
 
Closingthe Connection is all that's required. However, some will argue that
closing and destroying all of your objects explicitly makes your code neater
and easier to read...
 
I would argue it makes it harder to read, because then it gets cluttered
with lines that just set various objects to Nothing, etc.
 
I agree. In my case, I would be inserting several lines of
code in the view's OnDestroy function that would simply
set various objects to NULL on the way out of the
application. This would be very misleading to someone
reading the code and definitely make them think this is a
necessary step when in fact it appears (from what you guys
are saying) that ADO.NET object clean-up is automatic.
 
Back
Top