DAAB Error for UpdateDataSet() method

Topics: Data Access Application Block
Dec 20, 2012 at 11:27 AM


I am using UpdateDataSet() method for the Insert and Updates to happen on a particular table. But, after the statement execution, its throwing error as: "Cannot insert duplicate key row in object 'tableNameHere' with unique index 'indexNameHere'. The duplicate key value is (valueHere). The statement has been terminated." I ask for your kind support to get this error resolved.


Dec 24, 2012 at 7:11 AM

There is not a lot of detail in the question (see the Support How-to for some tips on posting) but it sounds like you are probably adding data to a disconnected DataSet which violates a unique constraint.

If the data you are trying to add does indeed violate the index then that what you are seeing is what I would expect.  This question might also be of interest to you.

In general, the DataSet functionality is a thin wrapper on ADO.NET.  e.g. ExecuteDataSet is really just doing a DataAdapter.Fill().  So, in most situations the approach you need to take is the same as if using a DataSet directly.

If you post more specific details then it would be possible to get a more specific answer.

Randy Levy
Enterprise Library support engineer
Support How-to