0

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.

skaffman
  • 398,947
  • 96
  • 818
  • 769
tanmay
  • 41
  • 1
  • 2

2 Answers2

0

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

Gerrie Schenck
  • 22,148
  • 20
  • 68
  • 95
  • 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 Apr 19 '10 at 08:29
0

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
  • 41
  • 1
  • 2