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
|
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_Project]([ID_project],[Project Category],[kick off date],[Location]) VALUES(@ID_project,@Project_Category, @kick_off_date,@Location)", connection);
// Paramètres
command.Parameters.Add(new SqlParameter("@ID_project", SqlDbType.NVarChar, 50));
command.Parameters.Add(new SqlParameter("@Project_Category", SqlDbType.NVarChar, 50));
command.Parameters.Add(new SqlParameter("@kick_off_date", SqlDbType.NVarChar, 50));
command.Parameters.Add(new SqlParameter("@Location", SqlDbType.NVarChar, 50));
command.Parameters["@ID_project"].Value = textBox_project_name.Text;
command.Parameters["@Project_Category"].Value = comboBox1.Text;
command.Parameters["@Location"].Value = comboBox2.Text;
command.Parameters["@kick_off_date"].Value = textBox_Date.Text;
command.ExecuteNonQuery();
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(@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_ )", connection);
// Paramètres
command.Parameters.Add(new SqlParameter("@ID_project", SqlDbType.NVarChar, 50));
command.Parameters.Add(new SqlParameter("@Duration_Estimate_PH_0", SqlDbType.Float));
command.Parameters.Add(new SqlParameter("@Duration_Estimate_PH_1", SqlDbType.Float));
command.Parameters.Add(new SqlParameter("@Duration_Estimate_PH_2", SqlDbType.Float));
command.Parameters.Add(new SqlParameter("@Duration_Estimate_PH_3", SqlDbType.Float));
command.Parameters.Add(new SqlParameter("@Duration_Estimate_at_Completion", SqlDbType.Float));
command.Parameters.Add(new SqlParameter("@ETM_PH_0_", SqlDbType.Float));
command.Parameters.Add(new SqlParameter("@ETM_PH_1_", SqlDbType.Float));
command.Parameters.Add(new SqlParameter("@ETM_PH_2_", SqlDbType.Float));
command.Parameters.Add(new SqlParameter("@ETM_PH_3_", SqlDbType.Float));
command.Parameters["@ID_project"].Value = textBox_project_name.Text;
command.Parameters["@Duration_Estimate_PH_0"].Value = ma_form_Add_informations.duration_estimate_ph0;
command.Parameters["@Duration_Estimate_PH_1"].Value = ma_form_Add_informations.duration_estimate_ph1;
command.Parameters["@Duration_Estimate_PH_2"].Value = ma_form_Add_informations.duration_estimate_ph2;
command.Parameters["@Duration_Estimate_PH_3"].Value = ma_form_Add_informations.duration_estimate_ph1;
command.Parameters["@Duration_Estimate_at_Completion"].Value = ma_form_Add_informations.duration_estimate_completion;
command.Parameters["@ETM_PH_1_"].Value = ma_form_Add_informations.etm_ph0;
command.Parameters["@ETM_PH_1_"].Value = ma_form_Add_informations.etm_ph1;
command.Parameters["@ETM_PH_2_"].Value = ma_form_Add_informations.etm_ph2;
command.Parameters["@ETM_PH_3_"].Value = ma_form_Add_informations.etm_ph3;
command.ExecuteNonQuery();
}
catch { }
} |
Partager