Are the database-related objects such as connection object, command object, datareader, dataadapter,… unmanaged resources?
Are the database-related objects such as connection object, command object, datareader, dataadapter,… unmanaged resources?
Share
The objects you refer to are part of the .NET framework, and are garbage-collectable. So in that sense they are managed resources.
A better question would be, do these objects implement
IDisposable? If they do, you can use theusingkeyword in C# to clean them up once they go out of scope, or call theirdispose()method manually.An example of using the
usingkeyword withSqlConnectionandSqlDataAdapterobjects is here:http://weblogs.asp.net/jasonsalas/archive/2005/02/08/368811.aspx