-2
I have 2 tables, products and suppliers. And is appearing the following message:
System.Data.Sqlclient.Sqlexception: 'The INSERT statement conflicted with the FOREIGN KEY Constraint "Fk_products_supplier". The Conflict occurred in database "C: USERS TIAGO DOCUMENTS VISUAL STUDIO 2017 PROJECTS PROJECTS WORK FINAL POO WORK FINAL POO BD.MDF", table "dbo.Supplier", column 'cnpj'.
Can someone explain me this mistake?
The message is stating what the error: You are trying to insert a product whose data is key to the headphone (
cnpj
) is not valid - IE, there is no registered supplier with the informed cnpj– Diego Rafael Souza
If still, there is some doubt, include your code to the question
– Leandro Angelo