Determine that ExecuteNonQuery executed successfully
<p>How can I know if data was inserted in the database successfully, or whether an error occurred when executing <code>ExecuteNonQuery()</code>?</p>

<pre><code>con.Open();

SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into DOCUMENT(NUM_D_ORDRE_DOC,ID_PERSONE,TYPE_DOC,PRIX_DOC,DATE_DE_MISE_EN_CHARGE,DATE_CREATION)values('"+TextBox1.Text+"','1','"+TextBox2.Text+"','"+TextBox4.Text+"','"+TextBox3.Text+"','"+ @DateTime.Now + "');";

cmd.ExecuteNonQuery();
con.Close();
</code></pre>