The update statement conflicted with the foreign key constraint

Fermé
mariem - Modifié par mariem le 10/03/2013 à 22:28
Bonjour,

Dans mon projet (en VB 2008 ) , j'ai trouvé une grande problème dans le cas de modification des données dans SQL
donc j'ai créé trois tables ( étudiant , classe , inscription)
étudiant : deux clé étrangères ( Num_inscription , Id_classe)
Inscription un clé étrangère (Id_classe)
classe : pas des clés étrangères

Et voici le code sur VB :


com.Connection = con
com.CommandType = CommandType.Text



com.CommandText = "update etudiant set CIN_etudiant='" & cin.Text & "' , Nom_prenom='" & nom.Text & "' , Sexe='" & sexe & "' , Date_Naissance='" & date_nais.Value.ToString & "' , Adresse='" & adr.Text & "' , Num_telephone='" & tele.Text & "' , annee_etude='" & etude.Text & "' , Num_Inscription='" & inscri.Text & "' where CIN_etudiant='" & Me.liste.SelectedValue.ToString & "' "


com.ExecuteNonQuery()


com.CommandText = "update inscription set Num_Inscription='" & inscri.Text & "' , Date_inscription='" & DATE_inscri.Value.ToString & "' where Id_classe='" & nbre & "' "

com.ExecuteNonQuery()


com.CommandText = "update classe set Niveau='" & niveau.Text & "' , Section='" & section.Text & "' , Groupe='" & grp.Value & "' where Id_classe='" & nbre & "' "


com.ExecuteNonQuery()

Mais malheureusement j'ai bloquée par cette erreur

the update statement conflicted with the foreign key constraint

SVP ! une solution :(