Karatas, FERHAT
I would love to change the world, but they won't give me the source code!
23.8.2006 05:38:58 - Filed under : Ado.net
System.ArgumentException: This constraint cannot be enabled as not all values have corresponding parent values.

This exception occurs if your lookup query does not return all the values that are used in the master-table. Some developers suggest that you enable referential integrity (ie, add a relation) in the database betweeen the lookup table and the master table; but this shouldnt prevent this scenario.

When I set "createConstraints" parameter to "false" then the error is disappeared.
ds.Relations.Add("myrelation", ds.Tables[0].Columns["ArticleID"], ds.Tables[1].Columns["ArticleID"],false);
Because, the exception is not related to Access. Remember the DataSet is disconnected and is independent from Access. This error can occur when a parent-child relationship is created and then children are loaded into the DataSet without the parent existing (whether or not the parent exists in the database is irrelevant - it has to exist in the DataSet as well because the DataSet is disconnected from the database)

Related Terminology : MS Access, Repeater, Dataset Relation
with 0 comments

What do you think ?
Security Code 6832
Check S. Code
Home Page