G
G .Net
Hi
I'm hoping that somebody can help me with a fairly puzzling problem.
I've created some DataTables which have relations between them e.g. one to
many. In the application, I want to remove entries from the table. To do
this I obviously need to temporarily switch off the relations. In order to
achieve this, I tried:
ds.Relations.Clear() ' where ds is the application DataSet
ds.Tables("table1").Clear()
but I get the exception:
"An unhandled exception of type 'System.ArgumentException' occurred in
system.data.dll
Additional information: Cannot remove unique constraint 'Constraint1'.
Remove foreign key constraint table1_table3' first."
What I don't understand is why the relations don't seem to have been
removed.
Can anybody point me in the right direction i.e. how do I switch off the
relations to allow the clearing of a table?
Many thanks in advance
Geoff
I'm hoping that somebody can help me with a fairly puzzling problem.
I've created some DataTables which have relations between them e.g. one to
many. In the application, I want to remove entries from the table. To do
this I obviously need to temporarily switch off the relations. In order to
achieve this, I tried:
ds.Relations.Clear() ' where ds is the application DataSet
ds.Tables("table1").Clear()
but I get the exception:
"An unhandled exception of type 'System.ArgumentException' occurred in
system.data.dll
Additional information: Cannot remove unique constraint 'Constraint1'.
Remove foreign key constraint table1_table3' first."
What I don't understand is why the relations don't seem to have been
removed.
Can anybody point me in the right direction i.e. how do I switch off the
relations to allow the clearing of a table?
Many thanks in advance
Geoff