Abbasi Posted December 3, 2005 Share Posted December 3, 2005 I am quoting a clear example of the Junction table, in Northwind sample database.When employing this database in a DataGrid, I receive DataConstraint Exception Error in the Junction table "Order Details" or in the "Orders" table, with the following error message:"Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."On displaying one of the errant tables, each row complains as below:"ForeignKeyConstraint, Shipper_Order (for example) requires the child key values ????? to exist in the parent table.NOTES: 1- I established Relations just according to the ones in MS Access application.2- The Same Database is Functioning normally inside MS Access application.3- I am mainly concerned about the Junction table.I need professional guidance as this is a study project, I am working on. Link to comment Share on other sites More sharing options...
aspnetguy Posted December 4, 2005 Share Posted December 4, 2005 please post your code you use to connect to the db, retrieve data, and bind to dataGrid.It is hard for me to guess where you went wrong if I don't know what you have done.Thanks Link to comment Share on other sites More sharing options...
kansasprog Posted December 4, 2005 Share Posted December 4, 2005 I am quoting a clear example of the Junction table, in Northwind sample database.When employing this database in a DataGrid, I receive DataConstraint Exception Error in the Junction table "Order Details" or in the "Orders" table, with the following error message:"Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."On displaying one of the errant tables, each row complains as below:"ForeignKeyConstraint, Shipper_Order (for example) requires the child key values ????? to exist in the parent table.NOTES: 1- I established Relations just according to the ones in MS Access application.2- The Same Database is Functioning normally inside MS Access application.3- I am mainly concerned about the Junction table.I need professional guidance as this is a study project, I am working on.<{POST_SNAPBACK}> ForeignKeyConstraint, Shipper_Order (for example) requires the child key values ????? to exist in the parent table. I think its a database issue . the junction table might have an id where it doesn't exist in the parent table.When you are trying to delete records in the database , delete them in the child table and then in the parent table. If we dont keep track of such things integrity might fail. Link to comment Share on other sites More sharing options...
Abbasi Posted December 4, 2005 Author Share Posted December 4, 2005 Thanks aspnetguy for the response. I found the reason of the problem. The sequence in which I filled the DataAdapters was not appropriate - the rule is load the Parent table before the Child table, otherwise meet the problem. Link to comment Share on other sites More sharing options...
aspnetguy Posted December 4, 2005 Share Posted December 4, 2005 glad you got it working Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now