Groups | Blog | Home
all groups > dotnet windows forms databinding > august 2006 >

dotnet windows forms databinding : Concurrency violation at update


John
8/30/2006 12:00:00 AM
Hi

I had a working vs 2003 application with access backend. I added a couple
fields in a table in access db and then to allow user to have access to
these fields via app I did the following;

1. Regenerated the data adapter sqls by running the data adapter wizard and
pasting the resulting code into my app.

2. Deleted the data adapter correspond to the relevant access table from the
dataset and re-dragged the table to dataset to have the new fields included
in the resulting data adapter.

3. Used below code to bind the windows form field to the underlying table
field;

db = New System.Windows.Forms.Binding("Text", ds, "tblClients.MyField")
txtMyField.DataBindings.Add(db)

Now when I run the app I can view the data in the fields including the new
ones but if I change any field and try to save (da.Update(ds.tblClients)),
I get the below error;

Concurrency violation: the UpdateCommand affected 0 records.

Even though only one user is running the app. What is the problem and how
can it be fixed?

Thanks

Regards

Miha Markic [MVP C#]
8/30/2006 12:00:00 AM
Hi John,

Why don't you look at Update command text?
I bet it is comparing all fields.
Now, I know that access has problems with datetimes - it sometimes strips a
part of time and there you go with your concurrency exception.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

[quoted text, click to view]

AddThis Social Bookmark Button