Avatar of ElrondCT
Flag for United States of America asked on

Intermittent concurrency violation in single-user operations

I'm struggling with an intermittent error in my VB .NET 2003 application. I have the app set up for single-user operations; optimistic currency has been turned off for all DataAdapters, and I check to make sure any .pdb file of the same name as the Access .mdb file that's being opened can be deleted, to make sure no one else is using the data file at the same time. I'm using a database that contains three tables, a parent and two child tables.

Occasionally, I am getting a concurrency error:

Concurrency violation: the UpdateCommand affected 0 records

The error seems to always occur on one of the child tables. using the following command:

                  dsCurrent = CType(dsEZ13A.GetChanges, dsEZ13)
                  If dsCurrent.Rent.Count <> 0 Then
                        result = DA.odbdaRent.Update(dsCurrent)
                    End If

Trying the update again, once I get the error, is pointless; the error will recur as long as I try. If I abandon the changes, shut down the program, and go back and make the same change, it always works. I think I've only noticed the problem when making changes to an existing record, rather than when entering new records.

The fact that it's intermittent (I haven't been able to define a series of steps to cause the error) means it'll be tough to try out suggestions, but I'd appreciate any thoughts on what might be going on.
Visual Basic.NET

Avatar of undefined
Last Comment

8/22/2022 - Mon

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.

That certainly seems like a reasonable way to go. I haven't worked with the Debug class before, so I'll need to do a bit of reading on that. No need for you to describe it further at this point; if I hit a wall, I'll let you know.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.