adding a new datarow and updating problem

  • Thread starter Thread starter Bar
  • Start date Start date
B

Bar

Hi,

I am adding a datarow with the following straightforward code to an access
database:

dsClient.tbClientenRow drClient;
drClient = (dsClient.tbClientenRow) this.dsClient1.tbClienten.NewRow();
drClient.Name = "John";
dsClient1.tbClienten.AddtbClientenRow(drClient);
this.daClient.Update(this.dsClient1);

If i am doing a second update on this dsClient with adding the following
code

drClient.Name = "John R."
this.daClient.Update(this.dsClient1);

I get an concurrency error:
Concurrency violation: the UpdateCommand affected 0 records.
Why is this happening and how can i resolve this issue? Very much thanks in
advance!

Bar
 
dsClient is a dataset
daClient is a dataadaptor

And the command objects are created by VStudio if that is what you mean.

Commandtext = INSERT INTO clienten(Name, Birthday) VALUES (?, ?)

It must be something simple and i think i am doing something basically wrong
and it looks like the second update sees the first update as an concurrency
problem. Actually the following snippet causes the fault:

dsClient.tbClientenRow drClient;
drClient = (dsClient.tbClientenRow) this.dsClient1.tbClienten.NewRow();
drClient.Name = "John";
dsClient1.tbClienten.AddtbClientenRow(drClient);
this.daClient.Update(this.dsClient1);
drClient.Name = "John R."
this.daClient.Update(this.dsClient1);
 
Back
Top