title: C# insert into access database: no error, command succeeds, but no data inserted
body: <p>I'm using C# (on Visual Studio 2013) with .Net 4.0 and an access 2002 database (.mdb)
  The data I'm trying to insert is stored in these variables:</p>
  
  <pre><code>int cantidad = int.Parse(txtCantParejas.Text);
  DateTime fechaActual = DateTime.Now;
  int dia = fechaActual.Day;
  int mes = fechaActual.Month;
  int anio = fechaActual.Year;
  int hora = fechaActual.Hour;
  int minuto = fechaActual.Minute;
  </code></pre>
  
  <p>I've built this query:</p>
  
  <pre><code>string query = "INSERT INTO Torneo (cantParejas,dia,mes,anio,hora,minuto)VALUES (@cantParejas,@dia,@mes,@anio,@hora,@minuto)";
  </code></pre>
  
  <p>And I have a connection string (connection test succeeds) stored in the variable "strDeConexion".</p>
  
  <p>So I try to insert the data into my table:</p>
  
  <pre><code>OleDbConnection dbConnection = new OleDbConnection(strDeConexion);
  OleDbCommand commandStatement = new OleDbCommand(query, dbConnection);
  dbConnection.Open();
  commandStatement.Parameters.Add("@cantParejas", OleDbType.Integer).Value = cantidad;
  commandStatement.Parameters.Add("@dia", OleDbType.Integer).Value = dia;
  commandStatement.Parameters.Add("@mes", OleDbType.Integer).Value = mes;
  commandStatement.Parameters.Add("@anio", OleDbType.Integer).Value = anio;
  commandStatement.Parameters.Add("@hora", OleDbType.Integer).Value = hora;
  commandStatement.Parameters.Add("@minuto", OleDbType.Integer).Value = minuto;
  commandStatement.ExecuteNonQuery();
  dbConnection.Close();
  </code></pre>
  
  <p>The columns in my Access database table are all of Integer type and there is also an autoincrementing column called "idTorneo" which is the primary key and I didn't include in my query (because it's auto increment).</p>
  
  <p>However, when I run my code, I get no errors (I tried wrapping the insertion in a try-catch and I see the "try" bit being executed). But when I check the data in my table, the table is empty. Since I get no errors I'm quite puzzled and don't know where to start looking.
  I tried inserting this way as well, with no luck:</p>
  
  <pre><code>commandStatement.CommandType = CommandType.Text;
  commandStatement.Parameters.AddWithValue("cantParejas", cantidad);
  commandStatement.Parameters.AddWithValue("dia", dia);
  commandStatement.Parameters.AddWithValue("mes", mes);
  commandStatement.Parameters.AddWithValue("anio", anio);
  commandStatement.Parameters.AddWithValue("hora", hora);
  commandStatement.Parameters.AddWithValue("minuto", minuto);
  </code></pre>
  
  <p>Any help on what could be wrong or how to investigate this issue will be appreciated :)</p>