title: VB.NET: Nesting "Using" for database access
body: <p>I'm wondering if this is a good way of doing data access, in terms of all the database objects being properly closed and disposed? For example:</p>
  
  <pre><code>Using conn As New SqlConnection(MyConnectionString)
    Using cmd As New SqlCommand("some SQL here", conn)
      ... add parameters ...
      conn.Open()
      Using dr As SqlDataReader = cmd.ExecuteReader()
        While dr.Read()
          ... do stuff ...
        Wend
      End Using
    End Using
  End Using
  </code></pre>
  
  <p>Is nesting <code>Using</code> like acceptable practice? If I exit the method at some point within the Read() loop, will the use of <code>Using</code> like this ensure all objects are cleaned up properly regardless?</p>