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
| protected void btnValiderModifier_Click1(object sender, EventArgs e)
{
try
{
c.cmd = c.cn.CreateCommand();
c.cmd.CommandText = "update Enfants set prenom ='" + TextBox_NPmodif.Text + "',DateNaissance='" + TextBox_DNmodif.Text + "',Scolarise='" + TextBox_Scolarisemodif.Text + "',Activite='" + TextBox_Activitemodif.Text + "' where codeEnfants =" + lablcode.Text;
if (c.cn.State == ConnectionState.Closed)
{
c.cn.Open();
}
c.cmd.ExecuteNonQuery();
Response.Write("<script>alert('Opération reussie')</script>");
gv_enfant.DataBind();
}
catch (Exception ex)
{
Response.Write("<script>alert ('Erreur lors de la modif!')</script>");
}
finally
{
if (c.cn.State == ConnectionState.Open)
{
c.cn.Close();
}
}
} |
Partager