Ist SqlCommand.Dispose () erforderlich, wenn zugeordnete SqlConnection entsorgt wird?
Normalerweise benutze ich folgenden Code:
using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConn"].ConnectionString))
{
var command = connection.CreateCommand();
command.CommandText = "...";
connection.Open();
command.ExecuteNonQuery();
}
Will meincommand
automatisch entsorgt? Oder auch nicht und ich muss es einpackenusing
Block? Muss es entsorgt werden?SqlCommand
?