Archive for the ‘ADO.NET’ Category
SqlConnection Close or Dispose
December 2, 2004
Leave a comment
Well we can call anything we want to.
This is how it works:
In case of SqlConnection, Dispose calls Close.
However, in case of the FileStream class Close calls Dispose.
Ideally I would have liked it to be consistent.
There seems to a bit of confusion owing to incorrect beta documentation about connection pooling and Dispose.
Now that, these are set right – Looks like we can call either one of them.
This is how it works:
In case of SqlConnection, Dispose calls Close.
However, in case of the FileStream class Close calls Dispose.
Ideally I would have liked it to be consistent.
There seems to a bit of confusion owing to incorrect beta documentation about connection pooling and Dispose.
Now that, these are set right – Looks like we can call either one of them.
Categories: ADO.NET