title: There is already an open DataReader associated with this Command which must be closed first
body: <pre><code>Dim staffid = TextBox1.Text
      Dim conn As New SqlConnection
      conn.ConnectionString = SqlDataSource1.ConnectionString
  
      Dim command1 As New SqlCommand("SELECT StaffDetails.StaffID, SUM(HolidayRequests.RequestTotalDays) AS Expr1 FROM HolidayRequests INNER JOIN StaffDetails ON HolidayRequests.Username = StaffDetails.UserName WHERE (StaffDetails.StaffID = staffID) GROUP BY StaffDetails.StaffID, HolidayRequests.ApprovalStatus HAVING (HolidayRequests.ApprovalStatus = N'approved')", conn)
      Dim command2 As New SqlCommand()
      conn.Open()
      Dim rdr As SqlDataReader
      rdr = command1.ExecuteReader
      Dim UpdateQuery As String
      While (rdr.Read())
  
          UpdateQuery = "UPDATE HolidayEntitlement set Holiday_Taken = @Expr1"
          command2.Parameters.AddWithValue("@Expr1", rdr("Expr1").ToString())
  
          'run update query
  
          command2.CommandText = UpdateQuery
          command2.ExecuteNonQuery()
  
          conn.Close()
      End While
  </code></pre>
  
  <p>The following error: 
  command2.ExecuteNonQuery: Connection property has not been initialized.</p>