title: c# forms outside the bounds of the array
body: <p>When I want to receive 3 values from the database.</p>
  
  <pre><code>16.5
  15.5
  15.5
  </code></pre>
  
  <p>With this code:</p>
  
  <pre><code>public static double calculateTotalPrice(int reserveringId)
  {
      double total=0;
      int i = 0;
  
      SqlCommand comm =  sqlCrud.returnSqlCommand("select g.prijs from gerechten g inner join besteld b on b.gerechtId=g.gerechtId where b.reserveringId='"+reserveringId+"'");
  
      SqlDataReader dt = comm.ExecuteReader();
  
      if (dt.HasRows)
      {
          while (dt.Read())
          {
              total += dt.GetDouble(i);
              i++;
          }
      }
  
      return total;
  }
  </code></pre>
  
  <p>It's telling me: </p>
  
  <blockquote>
    <p>Additional information: Index was outside the bounds of the array.</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks</p>