Hajjoura1987
Messages postés5Date d'inscriptionvendredi 18 mars 2011StatutMembreDernière intervention12 juin 2011
-
2 mai 2011 à 23:42
nhervagault
Messages postés6063Date d'inscriptiondimanche 13 avril 2003StatutMembreDernière intervention15 juillet 2011
-
4 mai 2011 à 21:39
[b]bjr,
Je suis entrain de programmer une application web sur VisualStudio2008 par C#
mais j'ai un problème dans la mise à jour de base de donnée par la méthode (GridView1_RowUpdating)
SVP, pouvez vous m'aidez par un un petit exemple
/b Voilà mon code, mais il fonctionne pas:
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
try
{
SqlConnection connection = new SqlConnection();
connection.ConnectionString = "Data Source=...";
connection.Open();
if (connection.State == ConnectionState.Open)
{
string log = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
string pwd = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
string d = ((TextBox)GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text;
string nom = ((TextBox)GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text;
string pre = ((TextBox)GridView1.Rows[e.RowIndex].Cells[5].Controls[0]).Text;
string tel = ((TextBox)GridView1.Rows[e.RowIndex].Cells[6].Controls[0]).Text;
string mail = ((TextBox)GridView1.Rows[e.RowIndex].Cells[7].Controls[0]).Text;
SqlCommand sqlcommand6 new SqlCommand("UPDATE [pfe2011].[dbo].[Developpeur] SET [nomUti]log,[Password_d] =pwd,[Droit] = D,[Nom_d]= no,[Prénom_d] = pre,[Num_tel] = tel,[email] = mail'");
sqlcommand6.Connection = connection;
sqlcommand6.ExecuteScalar ();
// sqlcommand6.ExecuteNonQuery();
}
}
catch (Exception E)
{ }
}