Bonjour
voila mon petit soucis...
ma 1ère requête fonctionne, les deux autres non! Rien ne s'écrit dans la base.
Quelqu'un serait-il me dire pourquoi? Et que fait-il que je change pour que ça marche?
Je vous mets le 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
public partial class Testage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        /*Récupération de l'identifiant (du Formateur)*/
        string TestLogin = System.Web.HttpContext.Current.User.Identity.Name.ToString();
        string login = TestLogin.Substring(TestLogin.IndexOf('\\') + 1);
        lblID_user.Text = login;
 
    }
 
    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
        if (CheckBox1.Checked == true)
        {
            // Chaîne de connexion
            string connectString = "Data Source=PROD006\\SQLEXPRESS;Initial Catalog=prototype;Integrated Security=True";
            // Objet connection
            SqlConnection connection = new SqlConnection(connectString);
            // Ouverture
            connection.Open();
            SqlCommand command = new SqlCommand("INSERT INTO ACTIVITE (id_user, type_act, version, evaluation) values ('" + lblID_user.Text + "', 'freins' ,'1', 'Acquis')", connection);
            // Execution
            command.ExecuteNonQuery();
            // Fermeture connection
            connection.Close();
 
        }
    }
 
    protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
    {
        if (CheckBox2.Checked == true)
        {                  // Chaîne de connexion
            string connectString = "Data Source=PROD006\\SQLEXPRESS;Initial Catalog=prototype;Integrated Security=True";
            // Objet connection
            SqlConnection connection = new SqlConnection(connectString);
            // Ouverture
            connection.Open();
            // Objet Command
            SqlCommand command = new SqlCommand("INSERT INTO ACTIVITE (id_user, type_act, version, evaluation) values ('" + lblID_user.Text + "', 'freins' ,'1', 'En cours d'acquisition')", connection);
            // Fermeture connection
            connection.Close();
 
        }
    }
    protected void CheckBox3_CheckedChanged(object sender, EventArgs e)
    {
        if (CheckBox3.Checked == true)
        {                  // Chaîne de connexion
            string connectString = "Data Source=PROD006\\SQLEXPRESS;Initial Catalog=prototype;Integrated Security=True";
            // Objet connection
            SqlConnection connection = new SqlConnection(connectString);
            // Ouverture
            connection.Open();
            // Objet Command
            SqlCommand command = new SqlCommand("INSERT INTO ACTIVITE (id_user, type_act, version, evaluation) values ('" + lblID_user.Text + "', 'freins' ,'1', 'Non acquis')", connection);
            // Fermeture connection
            connection.Close();
 
        }
    }
Merci de votre aide par avance