M
Michael
Hi,
After running the code:
SqlConnection conn = new
SqlConnection("server=.;database=Northwind;uid=sa");
SqlCommand cmd = new SqlCommand("select * from Customers", conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
dr.Close();
conn.Close();
conn = null;
The SQL Server Activity Monitor shows there are two sleeping
connections to Northwind database. Why?
Even I add:
conn.Dispose();
there is still one connection to Northwind. This connection will exists
until
my application is terminated.
According this situation, if I issue two commands, then there will be four
connections. Is this alright?
After running the code:
SqlConnection conn = new
SqlConnection("server=.;database=Northwind;uid=sa");
SqlCommand cmd = new SqlCommand("select * from Customers", conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
dr.Close();
conn.Close();
conn = null;
The SQL Server Activity Monitor shows there are two sleeping
connections to Northwind database. Why?
Even I add:
conn.Dispose();
there is still one connection to Northwind. This connection will exists
until
my application is terminated.
According this situation, if I issue two commands, then there will be four
connections. Is this alright?