Mỗi khác question here about Disposable objects, chúng ta có nên gọi Close() trước khi kết thúc khối sử dụng không?Tôi có phải đóng() một SQLConnection trước khi nó được xử lý không?
using (SqlConnection connection = new SqlConnection())
using (SqlCommand command = new SqlCommand())
{
command.CommandText = "INSERT INTO YourMom (Amount) VALUES (1)";
command.CommandType = System.Data.CommandType.Text;
connection.Open();
command.ExecuteNonQuery();
// Is this call necessary?
connection.Close();
}
_this._poolGroup = null; _ có nghĩa là kết nối không nhận được trở lại hồ bơi kết nối? vì vậy tôi sẽ có kết nối n-1? –