1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim strsql As String
Dim strConnexion As String = "Persist Security Info=true;Integrated Security=SSPI;database=parc municipal;server=USER-PC\AHMED"
Dim x As Exception
Try
strsql = " delete from categorie where nom_cat = '" & ListBox1.SelectedItem & "';"
Dim oConnection As New SqlConnection(strConnexion)
oConnection.Open()
Dim cmd As New SqlCommand(strsql, oConnection)
cmd.ExecuteNonQuery()
oConnection.Close()
MsgBox("ajout avec succes ", MsgBoxStyle.OkOnly, "ajout catégorie")
Me.Hide()
Catch x
MsgBox("L'erreur suivante a été rencontrée :" & x.Message)
End Try
End Sub |
Partager