Bonjour,
J'ai un problème avec un update.
Voici mon code

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 public string GetConnectionString()
    {
 
        return System.Configuration.ConfigurationManager.ConnectionStrings["csVinotheque"].ConnectionString;
 
    }
 
    private void UpdateQuantite(int quantite, int idprodcomm)
    {
 
        SqlConnection conn = new SqlConnection(GetConnectionString());
 
 
 
        string sql = "Update prodcomm set quantite= @quantite where idprodcomm = @idprodcomm"; 
 
        try
        {
 
            conn.Open();
 
 
            SqlCommand cmd = new SqlCommand(sql, conn);
 
 
            cmd.ExecuteNonQuery();
 
        }
 
        catch (System.Data.SqlClient.SqlException ex)
        {
 
            string msg = "Update Error:";
 
            msg += ex.Message;
 
            throw new Exception(msg);
 
        }
 
        finally
        {
 
            conn.Close();
 
        }
 
    }
Puis j'appelle ma fonction lorsque je clique sur mon bouton modifier:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
    protected void Modifier_Click(object sender, EventArgs e)
    {
 
 
 
            UpdateQuantite(8,47);
 
 
 
    }
Je ne vois pas d'où vient mon erreur...