-
DataReleation Error!
Hi All,
I am getting this error :
(Additional information: This constraint cannot be enabled as not all values have corresponding parent values.)
And I’m creating this relation
Dim relMemberNat As DataRelation
relMemberNat = New DataRelation("MemNat", myDS.Tables("Nat").Columns("Code"), myDS.Tables("Member").Columns("Nationality"))
myDS.Relations.Add(relMemberNat)
- “Nat” table is the Nationalities list table with “Code” filed as PK
- “Member” table is the Members data table with “Nationality” normal filed stors the "Code" value.
Any idea please.
-
It means that you have some entries in your child table that contain some values not included in your parent table. So you should check the related fileds to see if there is such an entry.
-
Thank u Lunatic3,
You are right, no errors now, but the relation is not working.
Do you think the method I'm using is not correct?
-
I dont know how you are utilizing this relation that you claim it does not work. Considering the syntax, it seems correct.
-
This is a brief of what I am donning in this part
A window form displays all member basic information, this data stored to members database directly, one of these information is for member nationality.
Nationalities stored in a separate table lists only nationality and have “Code” field as PK.
In members form I’m displaying the nationality in ComboBox and I need the value to change according the nationality code stored in members table when the user clicks Next or Back buttons.
I found to make a relation between these 2 tables will do the job, but!!!
-
Your parent table in the dataset should now contain an object called 'MemNat' (your relation name) and that containes the the filed of the child table. You should bind the desired control to this field.
You may like to look at this article for more info about working with master/details tables.
-
I already did all that, but no luck!!
"Members" tabel moves fine but "Nat" table does not move points always to the first row.