"You cannot add or change a record because a related record is required in table 'tblRoles'."

  • Thread starter Thread starter Sasha
  • Start date Start date
S

Sasha

Hi,

I have a typed dataset with a bunch of tables and many to many relations.
While updating I am having problems. From time to time (20% of times) I have
an exception with this message - "You cannot add or change a record because
a related record is required in table 'tblRoles'."; but other 80% times it
works. What can be wrong with this? Confuses the hell out of me...
Could anyone help?

Thank you!
 
You are trying to add a record in the child table ... the parent table will
not have a record for foreign key ...

If you use Add"Table"Row method of the child datatable, you will see that
the second overloads will require you to pass a parent row as the first
parameter. This parameter can either be reference to an existing row in the
parent table ... or a new parent row ...
 
Back
Top