Erreur dans la syntax update en vb.net

Fermé
safa - 7 juin 2011 à 12:05
 safa - 7 juin 2011 à 12:35
Bonjour,
j'ai un probleme de modification en vb.net .lorsque j'ai modifié un seul champ j'ai reçus cette erreur: "erreur dans la syntax update"
mais lors de la modification de tous les champs aucune erreur.
voiçi le code :
Cmdr = Cn.CreateCommand()
Cmdr.CommandText = "UPDATE produit SET code_produit=" & CType(TextBox6.Text, Integer) & ",designation='" & TextBox5.Text & "',quantité=" & TextBox7.Text & ",prix_unitaire=" & TextBox8.Text & ",tva=" & ComboBox2.Text & " where (code_produit=" & CType(Me.lv.SelectedItems(0).Text, Integer) & ")"


If Cmdr.ExecuteNonQuery() = 1 Then
MsgBox("modification fait avec succeé.", MsgBoxStyle.Information, "Modification de donnée")
End If
Call affichage()

A voir également:

1 réponse

sapma Messages postés 168 Date d'inscription vendredi 20 novembre 2009 Statut Membre Dernière intervention 7 juin 2011 5
7 juin 2011 à 12:12
Ajouter un point d'arrêt sur If Cmdr.ExecuteNonQuery() = 1 Then et copier ici la valeur de Cmdr

possible que c'est une erreur de textbox vide qui update un champ de table qui n'accepte pas la valeur vide ou null ...
0
dsl sapma ms j'ai pas bien vous compris
0
voila le code que j ai

If TextBox6.Text = "" Or TextBox5.Text = "" Or TextBox7.Text = "" Or TextBox8.Text = "" Or ComboBox2.Text = "" Then
MsgBox("veuillez remplir les champs", MsgBoxStyle.Exclamation, "Modification de donnée")
Exit Sub
Else
Cmdr = Cn.CreateCommand()
Cmdr.CommandText = "UPDATE produit SET code_produit=" & CType(TextBox6.Text, Integer) & ",designation='" & TextBox5.Text & "',quantité=" & TextBox7.Text & ",prix_unitaire=" & TextBox8.Text & ",tva=" & ComboBox2.Text & " where (code_produit=" & CType(Me.lv.SelectedItems(0).Text, Integer) & ")"


If Cmdr.ExecuteNonQuery() = 1 Then
MsgBox("modification fait avec succeé.", MsgBoxStyle.Information, "Modification de donnée")
End If
Call affichage()

End If




l erreur dans instruction update


les champs ne sont pas vide
l operation n affecte pas à un seul champ
mais pour tous les champs ça marche bien
0