title: c# closing sqlconnection and sqldatareader or not?
body: <p>I have this piece of code:</p>
  
  <pre><CODE>
  SqlConnection conn;
  string strconString = System.Configuration.ConfigurationManager.ConnectionStrings["SQLCONN"].ToString();
  conn = new SqlConnection(strconString);
  string cmdstr = "select status from racpw where vtgid = " + vtgid;
  SqlCommand cmdselect = new SqlCommand(cmdstr, conn);
  conn.Open();
  SqlDataReader dtr = cmdselect.ExecuteReader();
  if (dtr.Read())
  {
  return;
  }
  else
  {
  ...
  }
  dtr.Close();
  conn.Close();
  </code></pre>
  
  <p>Now my question is.
  If return, does my connection and dtr get closed automatically or should I use a bool variable and perform a return after my connections get closed?</p>