I have a parent table named "Devis" and its child table named "LigneDevis", I want to insert data into two tables using devisBindingSource and ligneDevisBindingSource, here the Update code :
private void devisBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.devisBindingSource.EndEdit();
this.ligneDevisBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.dBDataSet);
}
When I try to insert new rows in both tables, an error occured :
System.Data.SqlServerCe.SqlCeException was unhandled Message=Impossible d'insérer une valeur de clé étrangère, car il n'existe pas de valeur de clé primaire correspondante. [ Foreign key constraint name = Ligne_Devis ]
My question is : is there a solution to resolve Foreign Key constraint problem ? Thanks.