开发者

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

开发者 https://www.devze.com 2022-12-21 02:30 出处:网络
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?You only need to call Dispose becaus

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消