> > Basically..Am I going overkill on the Dispose methods? > > Not at all. If a class implements IDisposable, that means it > wants to call Dispose the absolute moment you're through. In > the case here, it means database connection resources are > returned to the pool to be used by others. I believe (thought > I have not tested) that if you weren't calling Dispose there, > you would soon run out of connection resources and > connections to the database would fail.
I can understand that on the connection object It seems weird on the command object, etc (especially as I'm linking them all together to fire off a single statement to a single database.surely only one would be responsible for connection resources?) I'll probably end up looking through the IL of the various Dispose methods and see if there's any logic that calls the Dispose methods of the other related objects If I find anything I'll obviously post it ..well..probably not here, but on one of the new lists :-) ) > the ADO.NET > > books I've looked through rarely call Dispose at all > (perhaps with the > > same reasoning that error handling is rarely shown in > books..to make > > the point of the example clear) > > This would be a significantly damning statement about an > ADO.net book that didn't call Dispose (or at least Close). > Something like that should always, always be done. Yeah I was quite surprised that it wasn't mentioned (or it was rarely mentioned) I have so far just skimmed the books though, so perhaps I've missed it :-) Thanks Merak You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.