title: Concurrency Error updating a row a second time C#
body: <p>HI I am getting the "Concurrency violation the updatecommand affected 0 of the expected 1 records." error while trying to update a row, <strong>weird thing is that I CAN update the row a single time and next time I repeat the process on the same row I get the error</strong>, I have already tryed the endinit and endedit thingys, any help would be appreciated!</p>
  
  <p>I am using c# and MySQL innodb</p>
  
  <pre><code>string cs = "server=" + fidaConfig.dtBDConfig.Rows[0][2] + ";user id=root;Password=" + fidaConfig.dtBDConfig.Rows[0][4] + ";persist security info=True;database=facturas"; 
  MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection() { ConnectionString = cs }; 
  switch (tableInvoice) 
  { 
  case "factura_idj": 
      dsLuiscencioTableAdapters.factura_idjTableAdapter idjAdapter = new Control_Administrativo.dsLuiscencioTableAdapters.factura_idjTableAdapter() { Connection = conn }; 
      dsLuiscencio.factura_idjDataTable idj = idjAdapter.GetData(); 
      var facturaidj = (from f in idj where f.no_factura_idj == InvoiceNumber select f).Single(); 
      if (DateTime.Today.Date &gt;= Convert.ToDateTime("01-01-2010") &amp;&amp; facturaidj.fecha.Date &lt;= Convert.ToDateTime("01-01-2010")) 
      { 
          var quieresactualizar = MessageBox.Show("Desea Actualizar el total de acuerdo a los nuevos impuestos?", "Reforma Fiscal", MessageBoxButtons.YesNo); 
          if (quieresactualizar == DialogResult.Yes) 
          { 
              switch (facturaidj.opt_iva) 
              { 
          case 1: 
              facturaidj.iva = 0; 
              facturaidj.total = facturaidj.subtotal; 
              break; 
          case 2: 
              facturaidj.iva = facturaidj.subtotal * 0.11; 
              facturaidj.total = facturaidj.subtotal * 1.11; 
              break; 
          case 3: 
              facturaidj.iva = facturaidj.subtotal * 0.16; 
              facturaidj.total = facturaidj.subtotal * 1.16; 
              break; 
          default: 
              break; 
  
              } 
              Number2Letter.Number2Letter n2l = new Number2Letter.Number2Letter(); 
              string totalwithnocents = n2l.Numero2Letra(facturaidj.total.ToString(), 0, 0, "peso", "", 
          Number2Letter.Number2Letter.eSexo.Masculino, 
          Number2Letter.Number2Letter.eSexo.Masculino).ToUpper(); 
  
              string strtotalconivaretenido = Math.Round(facturaidj.total, 2, MidpointRounding.ToEven).ToString("###########.00"); 
              string cents = strtotalconivaretenido.Substring(strtotalconivaretenido.IndexOf(".") + 1); 
  
              facturaidj.total_letra = string.Format(@"{0} {1}/100 {2}", totalwithnocents, cents, facturaidj.tipo_moneda).ToUpper(); 
              idj.EndInit(); 
              idjAdapter.Update(facturaidj);//this runs only the first time on a row, then throws the error 
          } 
      } 
      break; 
      continues......
  </code></pre>