Does End Using close an open SQL Connection

.net, sql, sql-server, vb.net

Solution

Exiting a using block calls .Dispose() on the object in question (`cn` in your example) which for a SqlConnection will close the connection and any open resources.

Problem

If I wrap a SQLConnection in a Using, should I close it or does the end using handle it? ``` using cn as new system.data.sqlclient.sqlconnection() cn.open '{do a bunch of other stuff with commands and datareaders here} cn.close 'Do I need this? end using ```

Original source