Closing the connection with the Close() method to release resources.?
Example:
using (SqlConnection connection = new
SqlConnection(connectionString))
connection.Open();
// Execute commands here
connection.Close();
Example:
using (SqlConnection connection = new
SqlConnection(connectionString))
connection.Open();
// Execute commands here
connection.Close();