Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Dataset Question

I've talked with different people about this so I want to get your thoughts!
When you fill a dataset and your done using it should you set it to Nothing or let the garbage collector take care of it?
Thanks all
jb
[244 byte] By [jcb1269] at [2007-11-11 10:19:04]
# 1 Re: Dataset Question
In general, it's best to let garbage collection take care of cleaning up managed objects. The exception is objects which hold scarce resources (e.g., database connections, file handles, GDI objects, etc.); in that case, you should call Close or Dispose as soon as you're done with them. Datasets do not maintain a connection to the database, so it's fine to let .NET clean them up automatically.
Phil Weber at 2007-11-11 20:48:15 >
# 2 Re: Dataset Question
Thanks phil. You da man...!
jcb1269 at 2007-11-11 20:49:20 >