Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What does Dispose method do with the connection object?

Answer Posted / abhishek

SqlConnection.Dispose - in addition to closing the connection, it also
clears stateful nature of the SqlConnection instance, like connection string
etc.Beneath this layer, in SqlConnection atleast, there is a connection
pooling mechanism, which eventually holds actual physical database
connections. Again, they aren't really unmanaged resources, but non .NET
resources nonetheless. Lest I cause any confusion SqlClient has TDS parsing
built into .NET code, so technically in this scenario - there wasn't any
unmanaged resource.

So in short, Dispose does not **have** to release unmanaged resources - and
by convention it does cleanup. Thats exactly what SqlConnection.Dispse
does - "clean up clean up everybody do your share"

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are windows services?

988


Can derived classes have greater accessibility than their base types?

934


What is the difference between string and string in c#?

970


What is dependency injection?

973


What Happens In Memory When You Box And Unbox A Value-type?

863


What is a custom attribute?

894


What type of data type conversion happens when the compiler encounters the following code?

927


What is sqladapter c#?

954


What is an indexer in c#?

964


What is the difference between ref and out parameters in c#?

996


what is the difference between a struct and a class in c#?

1142


How do I calculate relative time?

929


What are the 3 different types of arrays?

1022


Is multiple inheritance possible in c#?

1001


How does c# achieve polymorphism?

932