K
Kirsten
Suppose I open and close the connection like this:
SqlConnection conn = new SqlConnection(myConnectionString);
try
{
conn.Open();
...doSomething;
}
finally
{
conn.Close();
}
where connection pooling is enabled by default (I mean: I specify nothing in
the connection string like pool size, etc).
- Is the connection to SQL Server actually closed in "conn.Close()" or conn
stays in ConnectionState.Closed and the connection is added to the pool as
available?
- Should I call "conn.Close()" or let .NET close the connection as needed?
Thanks!
SqlConnection conn = new SqlConnection(myConnectionString);
try
{
conn.Open();
...doSomething;
}
finally
{
conn.Close();
}
where connection pooling is enabled by default (I mean: I specify nothing in
the connection string like pool size, etc).
- Is the connection to SQL Server actually closed in "conn.Close()" or conn
stays in ConnectionState.Closed and the connection is added to the pool as
available?
- Should I call "conn.Close()" or let .NET close the connection as needed?
Thanks!