Hi,
I'm having a hard time trying to update a table that has child tables.
I have a DataSet with 8 tables and each DataSet was filled with a different OracleDataAdapter.
Then i've created a relation between two of the tables like this:
Dim col1 As DataColumn = ds.Tables("users").Columns("USER_ID")
Dim col2 As DataColumn = ds.Tables("users_profile").Columns("USER_ID")
dr = New DataRelation("r1", col1, col2)
ds.Relations.Add(dr)
Dim fk As ForeignKeyConstraint = dr.ChildKeyConstraint
fk.DeleteRule = Rule.Cascade
fk.UpdateRule = Rule.Cascade
fk.AcceptRejectRule = AcceptRejectRule.Cascade
ds.EnforceConstraints = True
Follwed by:
oda.Update(ds.Tables("users"))
The goal is to delete one datarow in the parent table and have it 'Cascade' through the child tables, however i get an 'integrity constraint violated: child record found' error instead.
It seems the relation doesn't make any effect, i get the exactly same thing not using it..
tx in advance.
I'm having a hard time trying to update a table that has child tables.
I have a DataSet with 8 tables and each DataSet was filled with a different OracleDataAdapter.
Then i've created a relation between two of the tables like this:
Dim col1 As DataColumn = ds.Tables("users").Columns("USER_ID")
Dim col2 As DataColumn = ds.Tables("users_profile").Columns("USER_ID")
dr = New DataRelation("r1", col1, col2)
ds.Relations.Add(dr)
Dim fk As ForeignKeyConstraint = dr.ChildKeyConstraint
fk.DeleteRule = Rule.Cascade
fk.UpdateRule = Rule.Cascade
fk.AcceptRejectRule = AcceptRejectRule.Cascade
ds.EnforceConstraints = True
Follwed by:
oda.Update(ds.Tables("users"))
The goal is to delete one datarow in the parent table and have it 'Cascade' through the child tables, however i get an 'integrity constraint violated: child record found' error instead.
It seems the relation doesn't make any effect, i get the exactly same thing not using it..
tx in advance.