How to set up a DataRelation with Orphans ?

I am trying to set up a hierarchical relationship between 2 tables in a datset. I have a table tblParent and a table tblChildren but not all Children have Parents.

When I try to display, I get the error: This constraint cannot be enabled as not all values have corresponding parent values

Is it possible to have 'orphans' and if so how to I set up this relationship so it will allow children with no parents ?

Can anyone help ?

MamineAsked:
Who is Participating?
 
RonaldBiemansConnect With a Mentor Commented:
No, you can not do that with a datarelation object, what are you trying to achieve exactly, maybe there is another way to achieve the same.
0
 
MamineAuthor Commented:
Shame - will re-jig the data to fit. Thanks for your help again Ronald :)
0
 
scotthagieCommented:
Just turn the constraints off when creating the relation, the false at the end of the line:

MyDataSet.Relations.Add(TempRelationName, TempRelationColumnParent, TempRelationColumnChild, False)

Of course, you may have other problems later...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.