Give an example to ensure the database connections are always closed ?

Bharathi Cherukuri
Posted by Bharathi Cherukuri under ASP.NET category on | Points: 40 | Views : 950
To find whether the database connections are always closed, you have to open the connection inside of a using block.
By doing this, you will come to know that the connection is automatically closed when the code exits the block.

using (SqlConnection ConnectionObject = new SqlConnection())
//The database connection will be closed when the control exits the using code block

Comments or Responses

Login to post response