tags:

views:

276

answers:

1

When using IDbCommand, IDataReader, or DataTable, can you depend on the destructor to dispose resources, or will these objects leak resources if dispose is not called directly?

+2  A: 

They don't leak, but they will consume resources until they are garbage collected. The GC will call Dispose() on them. I don't think DataTable maintains a connection to the database, so you wouldn't have to worry about calling Dispose() or Close() on it.

See my answer here to a similar question.

SoloBold