Unhandled exception of type 'system.data.sqlclient.sqlexception'
jakbauer222
Messages postés
16
Statut
Membre
-
michel_m Messages postés 18903 Date d'inscription Statut Contributeur Dernière intervention -
michel_m Messages postés 18903 Date d'inscription Statut Contributeur Dernière intervention -
Imports System.Data.SqlClient
Public Class Supprimer_Produit
Dim Cn As New SqlConnection("Data Source=(localdb)\Projects;Initial Catalog=gestion;Integrated Security=True")
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Cn.Open()
Dim cmd As New SqlCommand("delete from Produit where idP=" & Val(ComboBox1.Text), Cn)
cmd.ExecuteNonQuery()
Cn.Close()
Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response As MsgBoxResult
msg = "etes vous sùre de vouloir supprimer ce produit !!"
style = MsgBoxStyle.DefaultButton2 Or _
MsgBoxStyle.Critical Or MsgBoxStyle.YesNo
title = "MsgBox Démonstration"
response = MsgBox(msg, style, title)
If response = MsgBoxResult.Yes Then
MsgBox("Produit Supprimé avec succés", 0 + 64, "1)") '
listes_Produits.Show()
Me.Close()
Else
Me.Show()
End If
End Sub
Private Sub Supprimer_Produit_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Cn.Open()
Dim cmd As New SqlCommand()
cmd.CommandText = "select idP from Produit"
cmd.CommandType = CommandType.Text
cmd.Connection = Cn
Dim Dr As SqlDataReader = cmd.ExecuteReader()
While Dr.Read
ComboBox1.Items.Add(Dr.Item(0))
End While
Dr.Close()
Cn.Close()
End Sub
End Class
Voila mon code ci dessus sv je veux de l'assistance unhandled exception of type 'system.data.sqlclient.sqlexception' occurred in system.data.dll
Public Class Supprimer_Produit
Dim Cn As New SqlConnection("Data Source=(localdb)\Projects;Initial Catalog=gestion;Integrated Security=True")
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Cn.Open()
Dim cmd As New SqlCommand("delete from Produit where idP=" & Val(ComboBox1.Text), Cn)
cmd.ExecuteNonQuery()
Cn.Close()
Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response As MsgBoxResult
msg = "etes vous sùre de vouloir supprimer ce produit !!"
style = MsgBoxStyle.DefaultButton2 Or _
MsgBoxStyle.Critical Or MsgBoxStyle.YesNo
title = "MsgBox Démonstration"
response = MsgBox(msg, style, title)
If response = MsgBoxResult.Yes Then
MsgBox("Produit Supprimé avec succés", 0 + 64, "1)") '
listes_Produits.Show()
Me.Close()
Else
Me.Show()
End If
End Sub
Private Sub Supprimer_Produit_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Cn.Open()
Dim cmd As New SqlCommand()
cmd.CommandText = "select idP from Produit"
cmd.CommandType = CommandType.Text
cmd.Connection = Cn
Dim Dr As SqlDataReader = cmd.ExecuteReader()
While Dr.Read
ComboBox1.Items.Add(Dr.Item(0))
End While
Dr.Close()
Cn.Close()
End Sub
End Class
Voila mon code ci dessus sv je veux de l'assistance unhandled exception of type 'system.data.sqlclient.sqlexception' occurred in system.data.dll
A voir également:
- Unhandled exception of type 'system.data.sqlclient.sqlexception'
- Clear type - Guide
- Appliquez à tous les paragraphes du document à télécharger, à l’exception des titres et des sous-titres, la mise en forme suivante : - Guide
- Type de ram - Guide
- Cb of london - Forum Vos droits sur internet
- Incompatibilité de type vba ✓ - Forum VB / VBA
1 réponse
BONJOUR ?
SVP MERCI ?
Au revoir...
lire d'urgence
https://www.commentcamarche.net/infos/25855-charte-d-utilisation-de-commentcamarche-net-respect-d-autrui/#politesse
SVP MERCI ?
Au revoir...
lire d'urgence
https://www.commentcamarche.net/infos/25855-charte-d-utilisation-de-commentcamarche-net-respect-d-autrui/#politesse