G
Guest
Hi
I am having a problem updating a DataTable that has a unique index on an
editable column.
For example, say there is a table with an integer field called [Value] that
has a SQL unique index. This column is in addition to the primary key.
Say that the table has five rows with values:-
PK Value
1 10
2 20
3 30
4 40
5 50
I fill a DataTable with these rows and let the user edit them to:-
PK Value
1 30
2 45
3 35
4 40
5 50
When these changes get submitted using a DataAdpater, they get sent to the
server row by row. The update of row 1 will fail because of the unique index
on the value column, there being already a row with value 30.
To update successfully the rows must be submitted in a specific order to
avoid the index violation. We can visually inspect the example above and
easily determine what the correct order is. This is not so easy in the
application.
Does anyone know a neat solution to this issue?
I am having a problem updating a DataTable that has a unique index on an
editable column.
For example, say there is a table with an integer field called [Value] that
has a SQL unique index. This column is in addition to the primary key.
Say that the table has five rows with values:-
PK Value
1 10
2 20
3 30
4 40
5 50
I fill a DataTable with these rows and let the user edit them to:-
PK Value
1 30
2 45
3 35
4 40
5 50
When these changes get submitted using a DataAdpater, they get sent to the
server row by row. The update of row 1 will fail because of the unique index
on the value column, there being already a row with value 30.
To update successfully the rows must be submitted in a specific order to
avoid the index violation. We can visually inspect the example above and
easily determine what the correct order is. This is not so easy in the
application.
Does anyone know a neat solution to this issue?