title: How can I create two commands in one connection?
body: <p>For example I want to <code>INSERT</code> data in database and also <code>UPDATE</code> another table. My code is like this </p>
  
  <pre><code>SqlConnection con = new SqlConnection("**");
  con.Open();
  SqlCommand cmd = con.CreateCommand();
  cmd.CommandText = "INSERT Borrowbook VALUES (@StudentID, @ISBN, @Title, @Date)";
  SqlParameter p1 = new SqlParameter("@StudentID", SqlDbType.NChar);
  p1.Value = textBox2.Text;
  cmd.Parameters.Add(p1);
  SqlParameter p2 = new SqlParameter("@ISBN", SqlDbType.NVarChar);
  p2.Value = textBox4.Text;
  cmd.Parameters.Add(p2);
  SqlParameter p3 = new SqlParameter("@Title", SqlDbType.VarChar);
  p3.Value = textBox3.Text;
  cmd.Parameters.Add(p3);
  SqlParameter p4 = new SqlParameter("@Date", SqlDbType.DateTime);
  p4.Value = dateTimePicker1.Text;
  cmd.Parameters.Add(p4);    
  cmd.ExecuteNonQuery();
  con.Close();
  MessageBox.Show("The books has been successfully borrowed!", 
      "Information ... ",
      MessageBoxButtons.OK, 
      MessageBoxIcon.Information, 
      MessageBoxDefaultButton.Button1);
  </code></pre>