bonjour,
j'ai ce code pour remplir deux tables. j'ai pas d erreur mais rien ne se passe;

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
 
namespace PPA_Base
{
    public partial class add_project : Form
    {
        Add_informations ma_form_Add_informations = new Add_informations();
        public add_project()
        {
            InitializeComponent();
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
 
                if (textBox_project_name.Text == "")
                {
 
                    MessageBox.Show("You must fill the name of project", " Reconfigure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    ma_form_Add_informations.nom_projet = textBox_project_name.Text;
                    ma_form_Add_informations.ShowDialog();
                }
        }
 
        private void add_project_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (MessageBox.Show("Vous vouler enregister ?", "Sortie de l'application", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                if (textBox_project_name.Text == "")
                {
                    MessageBox.Show("You must fill the name of project", " Reconfigure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    e.Cancel = true;
                }
                else
                {
                    try
                    {
                        // Chaîne de connexion
                        string connectString = @"Data Source=PC-DE-HAFID\SQLEXPRESS;Initial Catalog=hafid;Integrated Security=True";
                        // Objet connection
                        SqlConnection connection = new SqlConnection(connectString);
                        // Ouverture
                        connection.Open();
 
                        SqlCommand command = new SqlCommand("INSERT INTO [Table_PPA]([ID_project], [Duration Estimate PH 0], [Duration Estimate PH 1], [Duration Estimate PH 2], [Duration Estimate PH 3], [Duration Estimate at Completion], [ETM PH 0 ], [ETM PH 1 ], [ETM PH 2 ], [ETM PH 3 ]) VALUES('" + textBox_project_name.Text + "','" + ma_form_Add_informations.duration_estimate_ph0 + "','" + ma_form_Add_informations.duration_estimate_ph1 + "','" + ma_form_Add_informations.duration_estimate_ph2 + "','" + ma_form_Add_informations.duration_estimate_ph3 + "','" + ma_form_Add_informations.duration_estimate_completion + "','" + ma_form_Add_informations.etm_ph0 + "','" + ma_form_Add_informations.etm_ph1 + "','" + ma_form_Add_informations.etm_ph2 + "','" + ma_form_Add_informations.etm_ph3 + "')", connection);
                        command.ExecuteNonQuery();
                        command = new SqlCommand("INSERT INTO [Table_Project]([ID_project], [Project Category], [kick off date], Location) VALUES('" + textBox_project_name.Text + "','" + comboBox1.Text + "','" + textBox_Date.Text + "','" + comboBox2.Text + "')", connection);
                        command.ExecuteNonQuery();
                    }
                    catch { }
                }
            }
        }
    }
}
a votre avis pourquoi ne fonctionne pas,

merci