adambox
adambox

Reputation: 25501

Do I need to close a SqlDataReader before I call Dispose on it?

According to this, Dispose() on a SqlConnection calls Close(), so you don't need to call both, just Dispose(). Is it the same for a SqlDataReader?

Upvotes: 2

Views: 1126

Answers (1)

adambox
adambox

Reputation: 25501

You only need to call Dispose because calls Close.

I used .NET Reflector and found that DbDataReader's (the base of SqlDataReader) Dispose method does call Close.

Upvotes: 4

Related Questions