Not all values in the child column
ds.Tables["submenus"].Columns["submenu"]
have a value in the parent column
ds.Tables["menu"].Columns["menu"]
.
This happens when the child column has values like 1,2,3,4,5 and the parent column only has the values 1,2,3,4.
You should enforce this constraint in your database so that data entry will fail when adding
submenus
that do not have a parent
menu
.
For this to work you table structure should look something like:
Table "menus":
ID Menu
1 File
2 Edit
3 Extra
Table "submenus":
P_ID ID Menu
1 1 Open
1 2 Save
1 3 Close
2 1 Add
2 2 Remove
3 1 Options