title: Best way to insert multiple rows in mysql with c#?
body: <p>I need to input mutiple rows of data into this MySQL using C#.
  <a href="https://i.stack.imgur.com/zQypc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zQypc.jpg" alt="enter image description here"></a></p>
  
  <p>I have this code below for inserting one row, but I am not sure how to approach multiple rows at once. I need to input a maximum of 8 rows into the table. Should i make multiple constructors or is there a better way?</p>
  
  <pre><code>public class Vo2phases
  {
      //properties for vo2max phases
      public int VO2TestID { get; set; }
      public int Phase { get; set; }
      public DateTime Time { get; set; }
      public int Intensity { get; set; }
      public double RER { get; set; }
      public int Borgscale { get; set; }
      public int Pulse { get; set; }
  
      public Vo2phases(int _vo2testid, int _phase, 
                       DateTime _time, int _intensity, 
                       double _rer, int _borgscale, int _pulse)
      {
          //set parameters for phases
          VO2TestID = _vo2testid;
          Phase = _phase;
          Time = _time;
          Intensity = _intensity;
          RER = _rer;
          Borgscale = _borgscale;
          Pulse = _pulse;
      }
  
      public void addToDB()
      {
          try
          {
              //prepare for query
              var cmd = MySQL.readyQuery();
  
              //insert testdata to Vo2test
              cmd.CommandText = "INSERT INTO vo2phases_tb (Vo2_TestID, Phase, Time, Intensity, RER, Borgscale, Pulse) VALUES (@Vo2testid, @phase, @time, @intensity, @rer, @borgscale, @pulse);";
  
              cmd.Prepare();
              cmd.Parameters.AddWithValue("@vo2testid", VO2TestID);
              cmd.Parameters.AddWithValue("@phase", Phase);
              string TimeString = "00:" + Convert.ToString(Time.TimeOfDay.Hours) + ":" + Convert.ToString(Time.TimeOfDay.Minutes);
              cmd.Parameters.AddWithValue("@time", TimeString);
              cmd.Parameters.AddWithValue("@intensity", Intensity);
              cmd.Parameters.AddWithValue("@rer", RER);
              cmd.Parameters.AddWithValue("@borgscale", Borgscale);
              cmd.Parameters.AddWithValue("@pulse", Pulse);
  
              cmd.ExecuteNonQuery();
  
              cmd.Connection.Close();
          }
          catch (MySqlException ex)
          {
              Console.WriteLine(ex.Message);
          }
  
      }
  </code></pre>