MySQL Forums
Forum List  »  MySQL for Visual Studio

Re: Error "Cannot add or update a child row: a foreign key constraint fails when try insert new record" VS2010, VS2012
Posted by: Gabriela Martinez Sanchez
Date: September 24, 2014 08:49AM

Hi Luis,

Have you checked all the constraints that you have defined in your tables? This error is caused when a constraint its been broken.

I would suggest that you try to add a new record manually, using Workbench for example, so you can check if you have the same results.

You can download Workbench from

http://dev.mysql.com/downloads/workbench/

Or you can do this test by coding:

Here is an example using the MySQLCommand class

http://dev.mysql.com/doc/refman/5.0/es/connector-net-examples-mysqlcommand.html#connector-net-examples-mysqlcommand-executenonquery


Please check it and let us know if any of these worked for you.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Error "Cannot add or update a child row: a foreign key constraint fails when try insert new record" VS2010, VS2012
1059
September 24, 2014 08:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.