Dataset and Cascading keys

M

Mat

I'm having difficult with these cascading keys, but it maybe I'm too
hopeful as to their capabilities.

Situation;

A typed dataset, containing two complex types which.

TableA, columns (AppID int , Reference string)
TableB, columns (AppID int , Description string)

If within the code I create the dataset, and populate TableA with the
Reference. I then create TableB, populate the Description and set its
parent to be the first row within TableA.

It is then possible to give the row within TableA and have this
cascade down to the child row in TableB. I've tried this setting the
AppId in row0 of tableA and checking the dataset XML (also tried
applying the changes via AcceptChanges) and it doesn't seem to be
happening for me...but maybe I'm missing something.

Any ideas?

Cheers,
 
G

Guest

Hi Mat

You don't mention how you're updating your ID, but really it shouldn't matter

You need to add a ForeignKeyConstraint between your two ID columns (AppID in this case), and set the update rule to
Rule.Cascade eg.

Dim dFKey as ForeignKeyConstrain
dFKey = New ForeignKeyConstraint(dcParentAppID, dcChildAppID
dFKey.UpdateRule = Rule.Cascad

That should sort it
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top