What does Dispose method do with the connection object?
Answers were Sorted based on User's Feedback
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 is type casting. Explain it with reference to classes.
2 Answers HCL, JPMorgan Chase,
What is string empty?
How we convert private assembly into public assembly?
Explain the difference between proc. Sent by val and by sub?
I was trying to use an out int parameter in one of my functions. How should I declare the variable that I am passing to it?
What is serialization in unity?
What is the difference between == and object.equals?
Where do we set the min and max pool size for connection pooling?
Explain About remoting and web services. Difference between them
What is stringbuilder c#?
how background thread access to ui control?
What is dll in vb.net?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)