Bonjour à vous! c'est ma première fois de poster.
Je travail sur une application de gestion de stock; j'essaie d'enregistrer un client qui passe une commande dans la table commande mais j'ai toujours l'erreur suivant en image.
Je ne parviens pas trouver l'erreur dans mon code:
Merci de m'aider!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 Sub saveCmdClient(ByVal idClient As Integer, ByVal dateJour As Date) connexion = New SqlConnection(chaine) Dim req As String = "insert into Commande(IdClient, DateCmd) values('" & idClient & "," & dateJour & "')" Try connexion.Open() cmd = New SqlCommand(req) cmd.Connection = connexion cmd.CommandType = CommandType.Text cmd.CommandText = req Dim res As Integer = cmd.ExecuteNonQuery If res > 0 Then MsgBox("Enregistrer ", MsgBoxStyle.Information, "Rapport") Else MsgBox("Pas Enregistrer", MsgBoxStyle.Exclamation, "Rapport") End If 'fermeture de la connexion connexion.Close() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Rapport") End Try End Sub
Partager