title: How to fix fatal error encountered during command execution in asp.net
body: <p>I am getting error in <code>cmd.ExecuteNonQuery</code>. When I add data in the web form it says:</p>
  
  <blockquote>
    <p>'an exception of type MySql.Data,MySqlClient.MySqlException' occurred in MySql.Data.dll but was not found in user code. Additional Info..fatal error encountered during command execution.</p>
  </blockquote>
  
  <p>I can't find why it is resulting in a fatal error.</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      con.ConnectionString = "Data Source=localhost;Initial Catalog=fir;Integrated Security=True;User Name=root;Password=;";
      con.Open();
  }
  
  protected void btnSubmit_Click(object sender, EventArgs e)
  {
      MySqlCommand cmd = new MySqlCommand("insert into reportcrime" + "(Name,CNIC,Phone1,Phone2,Email,Gender,City,Address,CrimeType,CrimeDetail)values(@Name,@CNIC NO,@ContactNo.1,@ContactNo.2,@Email Address,@Gender,@City Name,@Postal Address,@Crime Type,@Crime Detail)",con);
  
      cmd.Parameters.AddWithValue("@Name",txtName.Text);
      cmd.Parameters.AddWithValue("@CNIC NO",txtCnicNo.Text.ToString());
      cmd.Parameters.AddWithValue("@Contact No.1",txtcontactNo1.Text);
      cmd.Parameters.AddWithValue("@Contact No.2",txtcontactNo2.Text);
      cmd.Parameters.AddWithValue("@Email Address",txtEmail.Text);
      cmd.Parameters.AddWithValue("@Gender",ddlGender.SelectedItem.Value);
      cmd.Parameters.AddWithValue("@City Name",txtCityName.Text);
      cmd.Parameters.AddWithValue("@Postal Address",txtaddress.Text);
      cmd.Parameters.AddWithValue("@Crime Type",ddlCrimeType.SelectedItem.Value);
      cmd.Parameters.AddWithValue("@Crime Details",txtCrimeDetails.Text);
  
      cmd.ExecuteNonQuery();
  }
  </code></pre>