concurrency violation

T

TheOne

Hi I am having problem with concurrency violation that I am getting
occasionally. I am only user accessing this test database and I am trying to
update this record. Sometimes I get this error sometimes I do not. I am
using command builder ( I know that is not perfect solution, but it is there
to be used), and I would like to understand and know what a problem is. I
tried using MSORA and Also Oracles ODP and I get same results. I am running
many applications same way and I am not getting this error but with this app
I do. Can you please help me understand it and try what a problem is.

Thanks,

Sinisa

--------------error message----------------------



System.Data.DBConcurrencyException: Concurrency violation: the UpdateCommand
affected 0 of the expected 1 records.

at
System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)

at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)

at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)

at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable,
DataTableMapping tableMapping)

at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)

at System.Data.Common.DbDataAdapter.Update(DataSet dataSet)

at COWWebService.DBMSOraProvider.processSQLUpdate(String sqlString, String
connectionString, DataSet updatedDataSet) in
c:\inetpub\wwwroot\COWWebService\COWProcesses\DB\DBMSOraProvider.vb:line 36

at COWWebService.DBMain.processSQLUpdate(String selectString, DataSet
updatedDataSet) in
c:\inetpub\wwwroot\COWWebService\COWProcesses\DB\DBMain.vb:line 132

at COWWebService.DBMain.processSQLUpdate(String selectString, Int32
objectID, String userName, String password, DataSet updatedData) in
c:\inetpub\wwwroot\COWWebService\COWProcesses\DB\DBMain.vb:line 67

at COWWebService.MainWebService.dbProcessTextUpdate(String userName, String
password, DataSet updateDataSet, Int32 objectID, String sqlString) in
c:\inetpub\wwwroot\COWWebService\MainWebService.asmx.vb:line 86 From
COWWEBSERVICE.MainWebService.dbProcessTextUpdate at time 21/03/2005 3:57:35
PM
 
K

Kevin Yu [MSFT]

Hi Sinisa,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you are getting a
DBConcurrencyException when trying to use aDataAdapter to update the data
source. If there is any misunderstanding, please feel free to let me know.

This is a typical concurrency issue. The DBConcurrencyException is thrown
by a DataAdapter during the update operation if the number of rows affected
equals zero.

For this kind of issue, there are two possibilities.

1. Another user is trying to update data in database. When the data is
modified, our DataAdapter cannot find the original data and throws the
exception.
2. We have written an incorrect UpdateCommand. If the UpdateCommand is
incorrect, the row to update cannot be found. Thus, app throws the
exception. Since you're using a command builder to get the UpdateCommand, I
suggest your handle DataAdapter.RowUpdating event. In the event handler, we
can get the actual command text to see if it is correct. If not, please try
to write an UpdateCommand manually.

For more information about DBConcurrencyException, please check the
following link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemdatadbconcurrencyexceptionclasstopic.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

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