views:

46

answers:

2

Hi all, In my project I have seen that at many places developer has just nullify the DataReader object after use and hasn't close or dispose.. I want to know the advace effect of doing so, I mean nullifying the datareader and not closeing them.

Thanks and Regards, Tanmay.

A: 

The best practice here is to encapsulate the code which uses the DataReader in a using block.

Gerrie Schenck
Thanks for the replay
tanmay
Dear Gerrie, Using / With block will not solve the problem because developer has already put nothing/ null at proper places, but haven't used .close() or .dispose() method in entire function.
tanmay
A: 

After seaching on net I found following link which give me clear answer.

http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/a025ee54-e452-474a-84ed-338cbdf827ec

tanmay