1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| If TextBoxCodeModule.Text Is Nothing Or TextBoxLibelleModule.Text Is Nothing Then
MsgBox("Vous devez remplir tous les champs avant d'ajouter une ligne à la table module.", MsgBoxStyle.Critical, "Gestionnaire de stagiaires")
Else
Try
Connexion = New SqlConnection("Data Source=ordinateur;" _
& "Initial Catalog=GestionStagiaires;Integrated Security=True")
Connexion.Open()
Commande = New SqlCommand("INSERT INTO MODULE VALUES('" & TextBoxCodeModule.Text & _
"'," & TextBoxLibelleModule.Text & ")", Connexion)
Commande.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Gestionnaire de stagiaires")
Finally
If Connexion.State = ConnectionState.Open Then
Connexion.Close()
End If
End Try
End If |
Partager