D
Doug Holland
The Dispose() method of SqlConnection will automatically
close the connection if it is open, but the Dispose()
method of SqlDataReader doesn't appear to close the
reader, is this by design?
using(SqlConnection _connection = new SqlConnection())
{
} // SqlConnection closed by SqlConnection.Dispose()
using(SqlDataReader _reader = returnsReader())
{
} // SqlDataReader NOT closed by SqlDataReader.Dispose()
close the connection if it is open, but the Dispose()
method of SqlDataReader doesn't appear to close the
reader, is this by design?
using(SqlConnection _connection = new SqlConnection())
{
} // SqlConnection closed by SqlConnection.Dispose()
using(SqlDataReader _reader = returnsReader())
{
} // SqlDataReader NOT closed by SqlDataReader.Dispose()