locked
C#, SqlConnection Close or Dispose ? RRS feed

  • Question

  • Hi All,
            I read on one site that ...

    "The Dispose also clears it from the poolGroup and gets rid of the UserConnectionOptions. So if you are sure you’re not going to use this specific connection object anymore then you are safe to Dispose it which will also take care of the closing."

    If my understanding is correct ...
    It means that Dispose method takes care of Closing the connection.

    But what if I am only Closing the connection ... does closing connection Disposes the object.
    ....

    I have a code where I am using many(more than 500) sql connections throughout the code. I am closing each and every connection after using connection, properly.

    But I am not disposing it.

    Does using so many objects leads to memory leak ,,, not completely responsible but atleast in some amount ?



    • Moved by parmita mehta Thursday, July 2, 2009 5:40 PM (From:Windows HPC Server Deployment, Management, and Administration)
    Thursday, July 2, 2009 4:41 AM

Answers