B
Ben Gavin
Hi,
I am running into an interesting problem. I have a process which
populates a strongly typed dataset from a database, updates the contents
(including adding new rows), and stores the contents back to the database.
All loads/updates are done via a SqlDataAdapter utilizing custom stored
procedures that have been built for this purpose.
The behavior that I am seeing is that on a rather intermittent basis, the
SqlDataAdapter.Update call will fail with a "Column 'x' is constrained to be
unique. Value 'y' already exists" (or something close to that). This
appears to happen most often on DataSets which contain a large number of
records (5000+), although I believe it has happened on smaller DataSets as
well.
To add to the confusion, resubmitting the same update a second time does
not necessarily cause the problem to occur again. This particular update is
part of a larger job, which if resubmitted, many times completes
successfully. Additionally the production server is a multi-processor
(dual) machine, and all development and testing systems are single processor
machines. I have done extensive code review, and have been unable to find
the reason behind these errors. The dataset definition does not change, the
code itself does not change (on the database or application server), and the
input data does not change, yet the job miraculously heals itself.
Is it possible that there is a race condition of sorts within the
DataAdapter's update methods which is causing this error to occur? Is it
possible that something within SQL Server 2000 is causing duplicate IDs to
be generated? The update itself is not running within a transaction, but
I'm fairly certain that I've seen the error for updates that were performed
within one.
Thanks,
Ben
I am running into an interesting problem. I have a process which
populates a strongly typed dataset from a database, updates the contents
(including adding new rows), and stores the contents back to the database.
All loads/updates are done via a SqlDataAdapter utilizing custom stored
procedures that have been built for this purpose.
The behavior that I am seeing is that on a rather intermittent basis, the
SqlDataAdapter.Update call will fail with a "Column 'x' is constrained to be
unique. Value 'y' already exists" (or something close to that). This
appears to happen most often on DataSets which contain a large number of
records (5000+), although I believe it has happened on smaller DataSets as
well.
To add to the confusion, resubmitting the same update a second time does
not necessarily cause the problem to occur again. This particular update is
part of a larger job, which if resubmitted, many times completes
successfully. Additionally the production server is a multi-processor
(dual) machine, and all development and testing systems are single processor
machines. I have done extensive code review, and have been unable to find
the reason behind these errors. The dataset definition does not change, the
code itself does not change (on the database or application server), and the
input data does not change, yet the job miraculously heals itself.
Is it possible that there is a race condition of sorts within the
DataAdapter's update methods which is causing this error to occur? Is it
possible that something within SQL Server 2000 is causing duplicate IDs to
be generated? The update itself is not running within a transaction, but
I'm fairly certain that I've seen the error for updates that were performed
within one.
Thanks,
Ben