Link to home
Create AccountLog in
Avatar of ElrondCT
ElrondCTFlag 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.
Avatar of Sancler

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of ElrondCT


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.