Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 534061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:34:21+00:00 2026-05-13T09:34:21+00:00

HI I am getting the Concurrency violation the updatecommand affected 0 of the expected

  • 0

HI I am getting the “Concurrency violation the updatecommand affected 0 of the expected 1 records.” error while trying to update a row, 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, I have already tryed the endinit and endedit thingys, any help would be appreciated!

I am using c# and MySQL innodb

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 >= Convert.ToDateTime("01-01-2010") && facturaidj.fecha.Date <= 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......
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:34:22+00:00Added an answer on May 13, 2026 at 9:34 am

    I don’t know if this will have anything to do but:

    I’ve finaly found my problem, this was
    not related to concurency at all, i’ve
    found the problem by testing the same
    code on a SQL Server database, it was
    giving me another error message, so
    then i figure out that maybe MS Access
    was wrong with his error, and the
    problem was something else!

    In addition you have the FLOAT issue mentioned before:

    MySqlCommandBuilder composes the
    UPDATE command using WHERE col=?1 AND
    col=?2 … In FLOAT columns you’ll
    never find an exact value in this way.

    Which can perfectly be extended to double values… the problem seems to be a combination of a incorrect error message when the update tries to find the value to update

    Could you try running the update command without actually updating anything? That is, instead of making an actual update, remove all the code except for the Update command so that the factura object is exactly the same and see if that works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting 'Dispatcher has no subscribers' error while trying to post message to a channel
Getting red warning message that expected identifier for this statement CALayer = ImageView.layer; Using
Getting this weird LINQ error. title = System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.Xml.Linq.XElement,System.String Here is the code I have:
I keep getting these errors while retreiving images here. 07-26 17:21:29.194: ERROR/AndroidRuntime(396): java.lang.RuntimeException: An
Following this tutorial (http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/handling-concurrency-with-the-entity-framework-in-an-asp-net-mvc-application), I learned how to save data and do concurrency checks
Getting extremely confused with an adminhtml module i'm trying to write! Effectively I have
Getting message expected identifier in red for below these two statements } else if
Getting 401 errors when trying to use ASP.NET back end in load balanced environment
I'm getting this error with following line: Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(html.toString()))); Details:
I have a query on my homepage that is getting slower and slower as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.