Violation of unique constraint while updating database. - 05-12-2009 , 01:45 AM
I use Sql server 2005 and have a table in the database that looks something
Id | Text | SeqNo
1 Text1 1001
2 Text2 1002
There is a unique constraint on seqNo.
The scenario is: I load the data into a dataset. Then I swap the two
orderlines in the dataset.
The orderline with id 1 is given seqNo 1002 and the orderline with id 2 is
given seqNo 1001.
When I try to update the database using the dataAdapter's update method I
get a constraint exception which tells me that SeqNo's unique constraint is
Using dataAdapter's update method only one row is updated at the time. The
constraint in the database is checked for each row that is updated.
Does anybody know a way around this?
|Thread Tools||Search this Thread|