Edit Trainer [Parameters]


SUBMITTED BY: Guest

DATE: Nov. 21, 2013, 12:22 a.m.

FORMAT: Text only

SIZE: 2.8 kB

HITS: 1163

  1. SqlCommand sqlcmd = new SqlCommand("update stagiaire set nom=@nom,prenom=@prenom,code_sp=@code_sp,sexe=@sexe,adresse=@adresse,datenaissance=@datenaissance where Id_stagiaire =@Id_stagiaire");
  2. sqlpr1 = new SqlParameter();
  3. sqlpr1.ParameterName = "@Id_stagiaire";
  4. sqlpr1.DbType = System.Data.DbType.Int16;
  5. sqlpr1.Direction = System.Data.ParameterDirection.Input;
  6. sqlpr1.Value = this.txtID.Text;
  7. sqlcmd.Parameters.Add(sqlpr1);
  8. sqlpr2 = new SqlParameter();
  9. sqlpr2.ParameterName = "@nom";
  10. sqlpr2.DbType = System.Data.DbType.String;
  11. sqlpr2.Direction = System.Data.ParameterDirection.Input;
  12. sqlpr2.Value = this.txtNom.Text;
  13. sqlcmd.Parameters.Add(sqlpr2);
  14. sqlpr3 = new SqlParameter();
  15. sqlpr3.ParameterName = "@prenom";
  16. sqlpr3.DbType = System.Data.DbType.String;
  17. sqlpr3.Direction = System.Data.ParameterDirection.Input;
  18. sqlpr3.Value = this.txtPrenom.Text;
  19. sqlcmd.Parameters.Add(sqlpr3);
  20. sqlpr4 = new SqlParameter();
  21. sqlpr4.ParameterName = "@code_sp";
  22. sqlpr4.DbType = System.Data.DbType.String;
  23. sqlpr4.Direction = System.Data.ParameterDirection.Input;
  24. sqlpr4.Value = this.CmbSp.Text;
  25. sqlcmd.Parameters.Add(sqlpr4);
  26. sqlpr5 = new SqlParameter();
  27. sqlpr5.ParameterName = "@sexe";
  28. sqlpr5.DbType = System.Data.DbType.String;
  29. sqlpr5.Direction = System.Data.ParameterDirection.Input;
  30. if (OppFemale.Checked == true)
  31. sqlpr5.Value = "Feminin";
  32. else
  33. sqlpr5.Value = "Masculine";
  34. sqlcmd.Parameters.Add(sqlpr5);
  35. sqlpr6 = new SqlParameter();
  36. sqlpr6.ParameterName = "@adresse";
  37. sqlpr6.DbType = System.Data.DbType.String;
  38. sqlpr6.Direction = System.Data.ParameterDirection.Input;
  39. sqlpr6.Value = this.txtAdrs.Text;
  40. sqlcmd.Parameters.Add(sqlpr6);
  41. sqlpr7 = new SqlParameter();
  42. sqlpr7.ParameterName = "@datenaissance";
  43. sqlpr7.DbType = System.Data.DbType.Date;
  44. sqlpr7.Direction = System.Data.ParameterDirection.Input;
  45. sqlpr7.Value = this.dateTimePicker1.Value.Date;
  46. sqlcmd.Parameters.Add(sqlpr7);
  47. sqlcon.Open();
  48. sqlcmd.Connection = sqlcon;
  49. sqlcmd.ExecuteNonQuery();
  50. MessageBox.Show("Modifier Effectué Avec Succès");
  51. sqlcon.Close();

comments powered by Disqus