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
| protected void Button1_Click(object sender, EventArgs e)
{
string MyConstring = "Data Source=PROD005\\SQLEXPRESS;uid=PROD005\\mauto-daisy;pwd=uniqu;Initial Catalog='C:\\DOCUMENTS AND SETTINGS\\MAUTO-DAISY\\MES DOCUMENTS\\STAGE_PROJET.MDF';Integrated Security=True";
SqlConnection con1 = new SqlConnection(MyConstring);
SqlConnection con2 = new SqlConnection(MyConstring);
try
{
con1.Open();
SqlCommand MyCommand1 = new SqlCommand();
SqlCommand MyCommand2 = new SqlCommand();
MyCommand1.Connection = con1;
MyCommand2.Connection = con2;
MyCommand1.CommandText = "INSERT INTO Etudier(code_course_content, course_content, code_group, code_course) values ('BO:25/08/92','" + txtContent1.Text + "','IG1','3')";
MyCommand2.CommandText = "INSERT INTO Observation(date, obs_day, code_group) values ('28/05/07','" + txtObs.Text + "','IG1')";
//SqlDataReader MyDataReader;
//MyDataReader =
MyCommand1.ExecuteReader();
MyCommand2.ExecuteReader();
/*while (MyDataReader.Read())
{
ListBox1.Text = MyDataReader.GetString(1);
} */
con1.Close();
}
catch (Exception ex)
{
Response.Write("<body><script>alert(\" " + ex.Message + "\");</script></body>");
}
} |
Partager