Concurrency violation problem.

G

Guest

Hi,

Using ADO.NET Table adapter in C# , am updating a record using VS2005
generated update command by passing dataset and the assocaited table like;
this.CustomerDataSet.CustomerTable.

while updating am getting "Concurrency violation: the UpdateCommand affected
0 of the expected 1 records.".

Any help on this would be appreciated,

Thanks,
Pachu
 
P

Petar Repac

Well, it seems like UPDATE command did not found a record to process.
When doing update DataAdapter sends UPDATE command to database and after
UPDATE has performed it asks DB "how many records did I update".

In this case DB says zero, and DataAdapter raised an exception.
Because it thinks that the reason for 0 updated records is that some
other client/session has deleted the record you wanted to update it
raises "Concurrency violation", but in fact the reason could be badly
written UPDATE command (look at the WHERE clause) or the fact that this
record never existed in DB.

Hope it helps,
Petar Repac
 

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