title: C# List<> - Insert into database
body: <p>I have this app where i get data from a <code>TextBox</code>, insert it into a <code>List&lt;&gt;</code> and then display a new line in the <code>CheckBoxList</code>.<br>
  Example:</p>
  
  <pre><code>List&lt;string&gt; quantidade = new List&lt;string&gt;();
  for (int i = 0; i &lt; CheckBoxListLinhas.Items.Count; i++)
  {
     quantidade.Add(TextBoxQuantidade.Text.ToString());
  }
  List&lt;string&gt; artigo = new List&lt;string&gt;();
  for (int i = 0; i &lt; CheckBoxListLinhas.Items.Count; i++)
  {
     artigo.Add(TextBoxArtigo.Text.ToString());
  }
  List&lt;string&gt; valor = new List&lt;string&gt;();
  for (int i = 0; i &lt; CheckBoxListLinhas.Items.Count; i++)
  {
     valor.Add(TextBoxValor.Text.ToString());
  }
  /*List&lt;string&gt; artigo = new List&lt;string&gt;();
    for (int i = 0; i &lt; CheckBoxListLinhas.Items.Count; i++)
    {
      artigo.Add(TextBoxArtigo.Text.ToString());
    }*/
  
  CheckBoxListLinhas.Items.Add(new ListItem("Quantidade: " + TextBoxQuantidade.Text + " Artigo: " + TextBoxArtigo.Text + " Valor: " + TextBoxValor.Text) + " Anexo: " + FileUpload1.FileName.ToString());
  </code></pre>
  
  <p>And then I want to insert every row from that <code>List&lt;&gt;</code> to the database and I already have this example:</p>
  
  <pre><code>SqlCommand sqlInsertList = new SqlCommand("Insert into linhas (quantidade,descricao,valor) VALUES(@quantidade,@descricao,@valor)", sqlConn);
  sqlInsertList.Parameters.AddWithValue("@quantidade", );
  sqlInsertList.Parameters.AddWithValue("@descricao", TextBoxArtigo.Text);
  sqlInsertList.Parameters.AddWithValue("@valor", float.Parse(TextBoxValor.Text, CultureInfo.InvariantCulture.NumberFormat));
  
  sqlConn.Open();                         
  sqlTran = sqlConn.BeginTransaction();
  sqlInsert.Transaction = sqlTran;        
  sqlInsert.ExecuteNonQuery();             
  sqlTran.Commit();
  </code></pre>
  
  <p>What is the easiest way I can do that and adapt my <code>SQLInsert</code>?</p>