--- Chris Anderson <[EMAIL PROTECTED]> wrote: > I just would like to know what the most appropriate techniques are for > Disposal of ADO.NET objects > > Basically..Am I going overkill on the Dispose methods?
Not IMO. > Also...What resources are actually being disposed? It depends. The connection is obviously the most important, but also the command can hold precious resources. (I believe from previous postings that the Oracle provider does so). And that's the real bugbear with dispose - what it does obviously depends on implementation, and for similar classes it may do different things. Add to this the tendency for implementations to change over time. The best course of action IMO is to always dispose. If possible wrap your data layer up in a simple abstraction, to prevent you writing repeatative code. > I can't find anything in the docs about it (just that Dispose should be > called if it exists, and you're finished with it) and 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) I agree wholeheartedly. The trouble is that the example is the exact opposite from clear, you scratch your head wondering what you should dispose. Peter __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.