adding a new datarow and updating problem

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
 
B

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);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top