title: Use result of a foreach loop
body: <p>New to c#. How can I use the result of the foreach loop. I want to Insert the result into my data table.</p>
  
  <p>Give a name to column to be inserted</p>
  
  <pre><code>foreach (DataRow row in objDataset1.Tables[0].Rows)
  {
      string strValue = row["code"].ToString();        
  }
  
  sc.Open();
  cmd = new SqlCommand("Insert into Table (Code, v1, v2, v3) values('" + strValue + "','" + ckv1.IsChecked.ToString() + "','" + ckv2.IsChecked.ToString() + "', '" + txtv3.Text + "')", sc);
  cmd.ExecuteNonQuery();
  </code></pre>