The using
will take care of it for you. Under the hood, SqlConnection.Dispose()
calls the SqlConnection.Close()
method, and SqlCommand.Dispose()
calls SqlCommand.Close()
.
As additional background, a using
statement is syntactic sugar for a try ... finally
that disposes the IDisposable
object in the finally
.