title: How to insert a multiple rows in SQL using stored procedures?
body: <p>I'm able to insert the the items in a single statement but what I want to do is to have another version using a Stored Procedures. How do I do that. Here's my code:</p>
  
  <pre><code>    private void button1_Click(object sender, EventArgs e)
          {
  #region Get Values
  
              string[] array = {textBox1.Text+":"+textBox5.Text,textBox2.Text+":"+textBox6.Text,textBox3.Text+":"+textBox7.Text,textBox4.Text+":"+textBox8.Text};
              string query = "";
              string product = "";
              int qty = 0;
              for (int i = 0; i &lt; array.Length; i++ )
              {
                  product = array[i].ToString().Substring(0,array[i].ToString().IndexOf(':'));
                  qty = int.Parse(array[i].ToString().Substring(array[i].ToString().IndexOf(':')+1));
                  if (string.IsNullOrEmpty(query))
                  {
                      query = "Insert Into MySampleTable Values ('"+product+"','"+qty+"')";
                  }
                  else
                  {
                      query += ",('" + product + "','" + qty + "')";
                  }
  
  
              }
  
  #endregion
  
              string connect = "Data Source=RANDEL-PC;Initial Catalog=Randel;Integrated Security=True";
              SqlConnection connection = new SqlConnection(connect);
              connection.Open();
              string insert = query;
              SqlCommand command = new SqlCommand(query,connection);
              command.ExecuteNonQuery();
              command.Dispose();
              connection.Close();
              connection.Dispose();
              label5.Visible = true;
              label5.Text = insert;
          }
      }
  </code></pre>
  
  <p>Sir/Ma'am, Your answers would be of great help and be very much appreciated. Thank you++</p>