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