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
|
{
// Chaîne de connexion
string connectString = @"Data Source=RENNDXPRDL2596\SQLEXPRESS;Initial Catalog=hafid;Integrated Security=True";
// Objet connection
SqlConnection connection = new SqlConnection(connectString);
// Ouverture
connection.Open();
SqlCommand command = new SqlCommand();
command.CommandText = "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(@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_)";
// Paramètres
command.Parameters.AddWithValue("@ID_project","textBox_project_name.Text");
command.Parameters.AddWithValue("@Duration_Estimate_PH_0","textBox_Duration_Estimate_PH_0.Text");
command.Parameters.AddWithValue("@Duration_Estimate_PH_1","textBox_Duration_Estimate_PH_1.Text");
command.Parameters.AddWithValue("@Duration_Estimate_PH_2","textBox_Duration_Estimate_PH_2.Text");
command.Parameters.AddWithValue("@Duration_Estimate_PH_3","textBox_Duration_Estimate_PH_3");
command.Parameters.AddWithValue("@Duration_Estimate_at_Completion","textBox_Duration_Dstimate_at_Completion.Text");
command.Parameters.AddWithValue("@ETM_PH_0_","textBox_ETM_Phase_0.Text");
command.Parameters.AddWithValue("@ETM_PH_1_","textBox_ETM_Phase_1.Text");
command.Parameters.AddWithValue("@ETM_PH_2_","Value = textBox_ETM_Phase_2.Text");
command.Parameters.AddWithValue("@ETM_PH_3_","textBox_ETM_Phase_3.Text");
command.ExecuteNonQuery();
} |
Partager