H
Herman
I'm using SQL Server from a Web App built with VB.Net
2003. I researched Garbage Collection and the Dispose
method. .Net 2003 Help, sqlconnection class, ms-
help://MS.VSCC.2003/MS.MSDNQTR.2004JAN.1033/cpref/html/frlr
fsystemdatasqlclientsqlconnectionclasstopic.htm, says this.
If the SqlConnection goes out of scope, it is not closed.
Therefore, you must explicitly close the connection by
calling Close or Dispose.
Sqlconnection uses unmanaged code.
The Close method help states;
Do not call Close or Dispose on a Connection, a
DataReader, or any other managed object in the Finalize
method of your class. In a finalizer, you should only
release unmanaged resources that your class owns directly.
If your class does not own any unmanaged resources, do not
include a Finalize method in your class definition. For
more information, see Programming for Garbage Collection.
This says that the SqlConnection is managed. I found
experts writing that the dispose method should be used if
available.
Which method should be used for the best scalability and
performance?
2003. I researched Garbage Collection and the Dispose
method. .Net 2003 Help, sqlconnection class, ms-
help://MS.VSCC.2003/MS.MSDNQTR.2004JAN.1033/cpref/html/frlr
fsystemdatasqlclientsqlconnectionclasstopic.htm, says this.
If the SqlConnection goes out of scope, it is not closed.
Therefore, you must explicitly close the connection by
calling Close or Dispose.
Sqlconnection uses unmanaged code.
The Close method help states;
Do not call Close or Dispose on a Connection, a
DataReader, or any other managed object in the Finalize
method of your class. In a finalizer, you should only
release unmanaged resources that your class owns directly.
If your class does not own any unmanaged resources, do not
include a Finalize method in your class definition. For
more information, see Programming for Garbage Collection.
This says that the SqlConnection is managed. I found
experts writing that the dispose method should be used if
available.
Which method should be used for the best scalability and
performance?