|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
VS 2003, false data concurrency errorHi
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 "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. Show quote "John" <John@nospam.infovis.co.uk> wrote in message news:uBCy3$HWHHA.2256@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 > > > > 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 Show quote "Earl" <brikshoe@newsgroups.nospam> wrote in message news:eyvN5XNWHHA.4404@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" <John@nospam.infovis.co.uk> wrote in message > news:uBCy3$HWHHA.2256@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 >> >> >> >> > >
Show quote
"John" <John@nospam.infovis.co.uk> wrote in message If you are using generated code to do the updates, then it probably looks news:uBCy3$HWHHA.2256@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 > > > 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. |
|||||||||||||||||||||||