What does Dispose method do with the connection object?

Answers were Sorted based on User's Feedback



What does Dispose method do with the connection object?..

Answer / 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

What does Dispose method do with the connection object?..

Answer / guest

Deletes it from the memory.

Is This Answer Correct ?    3 Yes 6 No

Post New Answer

More C Sharp Interview Questions

What is difference between list and dictionary in c#?

0 Answers  


wipro interview question on 28-Apr-10 1.what type of authentication used in web service, 2.what are type of multithreding ? 3.diff bet delegate and multithreading? 4.how to write update query trigger in stored procedure. 5. if you are so sharp then what happens when you click .net appln exe in system,who CLR get loaded. 6.how to use work flown in application. 7.what is main purpose of script manager. 8.how u handle cretical transaction. 9.how you syncronize the method from no of user, 10.how change name of shared assambly

1 Answers  


Explain About web methods and its various attributes

0 Answers   Digital GlobalSoft,


What is the difference between array and list in c#?

0 Answers  


What is private class in c#?

0 Answers  






When static constructor is invoked?

9 Answers   TCS,


What is delegates and events?

0 Answers  


How does c# achieve polymorphism?

0 Answers  


Why do we use abstract class in c#?

0 Answers  


What are sorted lists?

0 Answers  


Explain About namespaces

0 Answers  


Explain how do you debug an asp.net web application?

0 Answers  


Categories