Bonjour,

J'ai une table Annotation composée de 4 champs : Code - Nom - Date - Commentaires (Code et un champ auto - incrémenté).

J'ai dans ma page aspx trois contrôle : un label - un texbox - un editeur ajax (CustomEditor)

J'ai fait une fonction (clic sur un bouton image) qui me permet de récupérer le contenu de ces trois champs et de faire une insertion dans ma base de données.
Cependant, j'obtiens une erreur de syntaxe au niveau de ma ligne d'execution et je ne comprend pas pourquoi ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
<asp:Label ID="LabelNom" runat="server" Text="Nom" ></asp:Label>
<asp:TextBox ID="DateAnnotation" runat="server" Width="100px"  ></asp:TextBox> 
<custom:CustomEditor ID="EditeurZoneDescription" Width="93%" Height="200px" runat="server" />
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
protected void BoutonAjouterAnnotation_Click(object sender, ImageClickEventArgs e)
        {
            //if (EditeurZoneDescription.Content.ToString() != "")
            {
                //Définition de la chaine de connexion
                string c_string = @"data source=JF\PRO; initial catalog=BaseExemples; integrated security=true";
                SqlConnection cx = new SqlConnection(c_string);
 
                //Ouverture de la connexion
                 cx.Open();
 
                //Insertion d'une nouvelle annotation dans la base de données
                string rqAnnotation = " INSERT INTO Annotation(,Nom,Date,Commentaires) values (,@Nom,@DateAnnotation,@Commentaire)";
                SqlCommand SqlAnnotation = new SqlCommand(rqAnnotation, cx);
 
                SqlAnnotation.Parameters.Add("@Nom", SqlDbType.VarChar, 50);
                SqlAnnotation.Parameters.Add("@DateAnnotation", SqlDbType.VarChar, 10);
                SqlAnnotation.Parameters.Add("@Commentaire", SqlDbType.VarChar, 300);
 
                //Affectation d'une valeur aux paramètres
                SqlAnnotation.Parameters["@Nom"].Value = LabelNom.Text;
                SqlAnnotation.Parameters["@DateAnnotation"].Value = DateAnnotation.Text;
                SqlAnnotation.Parameters["@Commentaire"].Value = EditeurZoneDescription.Content.ToString();
 
                int nbsite = SqlAnnotation.ExecuteNonQuery();
 
                //Mise à jour du tableau
                //GridViewListeAnnotations.DataBind();
 
                //Fermeture Connexion
                cx.Close();
            } 
        }
Est-ce que quelqu'un verrait un problème dans mon code ? Merci;