Bonsoir
J'ai développé un projet vb.net 2008 en connection avec base de donnée SQL server 2005. Je voudrai modifier la base de données avec un bouton modifier (btmodifier) mais le code ne marche pas il existe des erreurs.
Voici le code du bouton :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Private Sub btmodifier_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btmodifier.Click
        Dim strConnexion As String = "Data Source=PC-DE-USER\SQLEXPRESS;Initial Catalog=BDecheance;Integrated Security=True"
        Dim oConnection As New SqlConnection(strConnexion)
        Dim oCommand As New SqlCommand
        oConnection.Open()
        Dim strRequete As String = "UPDATE client SET ncin = @ncin WHERE nom=@nom; "
         oCommand.Parameters("@ncin").Value = CInt(tbcin.Text)
        oCommand.Parameters("@nom").Value = tbnom.Text
        oCommand.Connection = oConnection
        oCommand.CommandText = strRequete
        oCommand.ExecuteNonQuery()
        oCommand.Connection.Close()
        MessageBox.Show("client modifié")
    End Sub
Et voila l'erreur
Un SqlParameter avec ParameterName '@ncin' n'est pas contenu dans ce SqlParameterCollection .
Merci de m'aider !!!
NB: la table à modifier contient les champs suivantes: ncin,nom,prenom,adresse,ville,telephone,fax,gsm,email