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: Luis Chuello
Date: September 24, 2014 09:50AM

Hi Gabriela;

Thank you very much for your help, but fortunately I was able to solve my problem; the solution was quite simple although I would like to know why it happen, I'll explain my solution for others having the same problem can solve it.

The problem starts because the wizard places the value -1 to AutoIncrementSeed and AutoIncrementStep properties of primary keys in each table, the solution was to put both properties with the value 1, that way when you run queries Inserting, Deleting and Updating the Primary Keys coincide with Foreign Keys.

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
2143
September 24, 2014 09:50AM


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.