bonjour ,
J'ai un petit soucis avec cette erreur ( Cannot add or update a child row: a foreign key constraint fails (`g_salarie`.`dossier`, CONSTRAINT `FK_dossie ) au niveau de l'inserction je sais pas que je dois faire , sil vs plait quelqu'un peut m'aider a résoudre le problème.
merci d'avance
voici Voici mes requêtes d'insertion a la base de données ;
Ainsi mes requêtes de création de table
Code java : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 a=stmt.executeUpdate("insert into dossier values ('"+z+"','"+dt_naiss+"','"+this.lieu_naiss.getText()+"','"+Integer.parseInt(this.tele.getText())+"','"+this.adr.getText()+"','"+this.situa_fam.getSelectedItem()+"','"+Integer.parseInt(this.nbr_enf.getText())+"','"+Integer.parseInt(this.mat.getText())+"')"); a2=stmt.executeUpdate("insert into perssonel values('"+Integer.parseInt(this.mat.getText())+"','"+this.cin.getText()+"','"+this.Nom_txt.getText()+"','"+this.pr.getText()+"','"+dt_rec+"','"+1+"','"+this.cmr.getText()+"','"+z+"','"+Integer.parseInt(this.code_bnq.getText())+"','"+Integer.parseInt(this.code_mut.getText())+"','"+x+"')");
Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 CREATE TABLE dossier( id_dossier int (11) Auto_increment NOT NULL , date_naiss Date NOT NULL , lieu_naiss Varchar (30) NOT NULL , tele Int NOT NULL , addresse Varchar (40) NOT NULL , situation_fam Varchar (20) NOT NULL , nbr_enfant Int NOT NULL , matricule Int NOT NULL , PRIMARY KEY (id_dossier ) // ----- CREATE TABLE perssonel( matricule Int NOT NULL , CIN_per Varchar (20) NOT NULL , nom_per Varchar (30) NOT NULL , prenom_per Varchar (30) NOT NULL , date_rec Date NOT NULL , CMR Int NOT NULL , id_dossier Int NOT NULL , code_banque Int NOT NULL , code_mutuelle Int NOT NULL , id_grade Int NOT NULL , PRIMARY KEY (matricule )
Partager