By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,058 Members | 1,213 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,058 IT Pros & Developers. It's quick & easy.

Concurrency violation from IDbDataAdapter

P: n/a
Hidey ho,

This question relates to IDbDataAdapter, DataSets, XML, and DiffGrams.

I have a data adapter of type IDbDataAdapter and a dataset with one
table in it, which has one row in it, which has a RowState of Modified.

My dataadapter has been constructed properly in that it has all 4
Command objects required. The data connection object that the adapter
uses is of type IDbConnection (you guessed it!).

The problem is on the call to the Update method of the data adapter,
resulting in the ever detailed exception: "Concurrency violation: the
UpdateCommand affected 0 records".

Now here's the cool stuff. It only does this on the second (and
subsequent) times it hits this code. The first Update call (whether the
row is 'Added', 'Modified' or 'Deleted' works fine. The second one
doesn't.

Here's some more information possibly of use.

The dataset has actually been loaded from XML. In fact, its been loaded
from 2 sets of XML. The first XML was a Schema and data
(XmlReadMode.ReadSchema).
After this I have loaded a second XML file to the same dataset, which
is DIFFGRAM.
This allows for the ROWSTATE changes to be passed from the original
location (another PC in another part of cyberspace).
After this, I manually remove all rows that have a ROWSTATE of
UNCHANGED, simply because I want to and also because sometimes the data
adapter UPDATE method was adding those rows to the database anyway,
despite not having 'ADDED' rowstate.
So I am left with (USUALLY ONLY ONE) rows that have been edited,
deleted or created, in the dataset. Then the UPDATE call, and the
error.

Hmm, can't think of anything else relevant right now.

I appreciate any help or debugging suggestions.

Cheers,
Steven Nagy

Dec 8 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.