467,888 Members | 1,518 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,888 developers. It's quick & easy.

VS 2003, false data concurrency error

Hi

I have a vs 2003 winform data app. All the data access code has been
generated using the data adapter wizard and then pasted into the app. The
problem I have is that I am getting a data concurrency error on
mydataadapter.update() method. I know that there is no data concurrency
problem as I am the only user testing the app. Obviously the error is
misleading. What can I do from here to fix this problem?

Thanks

Regards


Feb 25 '07 #1
  • viewed: 1216
Share:
3 Replies
"I am the only user testing the app" is not a valid indication of what
constitutes concurrency nor will it prevent a concurrency error. In a
nutshell, "concurrency" at the time of update is a requirement that the
original dataource be the same as it was when the initial query was issued.
This can occur with 1-to-infinity users.

What might happen with a single user that causes a concurrency error? The
best example I can think of is where a user updates a row in a datagrid but
does not execute a re-query, then tries to update the same row in the
datagrid again. Well, will the data in the datasource now match the original
query? It most certainly will not, and thus this is why the
Microsoft-generated update logic includes an additional query.

The most reliable and easiest technique to ensure concurrency is to use a
primary key column and timestamp column to compare against for concurrency
and to ensure that those columns you are using to ensure concurrency do in
fact match the original data at the time of update. If not, find out why.

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:uB**************@TK2MSFTNGP02.phx.gbl...
Hi

I have a vs 2003 winform data app. All the data access code has been
generated using the data adapter wizard and then pasted into the app. The
problem I have is that I am getting a data concurrency error on
mydataadapter.update() method. I know that there is no data concurrency
problem as I am the only user testing the app. Obviously the error is
misleading. What can I do from here to fix this problem?

Thanks

Regards


Feb 25 '07 #2
There isn't a second process I can see that is updating the db. I have also
checked that all field sin the backend access db have required=no and Allow
Zero Length=Yes.

Any ideas? Thanks.

Regards

"Earl" <br******@newsgroups.nospamwrote in message
news:ey**************@TK2MSFTNGP03.phx.gbl...
"I am the only user testing the app" is not a valid indication of what
constitutes concurrency nor will it prevent a concurrency error. In a
nutshell, "concurrency" at the time of update is a requirement that the
original dataource be the same as it was when the initial query was
issued. This can occur with 1-to-infinity users.

What might happen with a single user that causes a concurrency error? The
best example I can think of is where a user updates a row in a datagrid
but does not execute a re-query, then tries to update the same row in the
datagrid again. Well, will the data in the datasource now match the
original query? It most certainly will not, and thus this is why the
Microsoft-generated update logic includes an additional query.

The most reliable and easiest technique to ensure concurrency is to use a
primary key column and timestamp column to compare against for concurrency
and to ensure that those columns you are using to ensure concurrency do in
fact match the original data at the time of update. If not, find out why.

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:uB**************@TK2MSFTNGP02.phx.gbl...
>Hi

I have a vs 2003 winform data app. All the data access code has been
generated using the data adapter wizard and then pasted into the app. The
problem I have is that I am getting a data concurrency error on
mydataadapter.update() method. I know that there is no data concurrency
problem as I am the only user testing the app. Obviously the error is
misleading. What can I do from here to fix this problem?

Thanks

Regards



Feb 25 '07 #3

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:uB**************@TK2MSFTNGP02.phx.gbl...
Hi

I have a vs 2003 winform data app. All the data access code has been
generated using the data adapter wizard and then pasted into the app. The
problem I have is that I am getting a data concurrency error on
mydataadapter.update() method. I know that there is no data concurrency
problem as I am the only user testing the app. Obviously the error is
misleading. What can I do from here to fix this problem?

Thanks

Regards
If you are using generated code to do the updates, then it probably looks
for a record with every field matching the original value of the field in
your recordset. Something like this:

update myTable Set field1 = @field1, field2 = @field2
where field1 = @field1_prev, field2 = @field2_prev

....where @field1_prev and @field2_prev are the original values held in the
dataset for those fields (see DataRowViewState, which is maintained for
each row in the dataset).

So if you are changing any of the original values in the database somehow,
it won't find the record, and it will throw a concurrency error.

Hope this helps.
Robin S.
Feb 25 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Ger | last post: by
5 posts views Thread by Mr | last post: by
4 posts views Thread by George | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.