Muss ich eine SQLConnection schließen (), bevor sie entsorgt wird?
Für meinen AnderenFrage hier über EinweggegenständeSollen wir Close () vor dem Ende eines using-Blocks aufrufen?
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();
}