Bonjour!
Ce bout de code ci-dessous m'affiche ce message d'erreur suivant: "Cannot implicitly convert type 'void' to 'System.Data.SqlClient.SqlDataReader'"
Je suis débutant t en c# et j'avoue que ce message est incompréhensible pour moi,c'est pourquoi je me tourne vers vous pour trouver une solution. Merci!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 public EmployeInfo(int matriculeemploye) { DataBaseHelper dh = new DataBaseHelper(); SqlDataReader dr; dr = dh.ExecuteReader("Select * from Employe where Matricule = "+matriculeemploye); if (dr.Read()) { matricule=dr.GetInt32(Matricule); nom=dr["Nom"].ToString(); prenom=dr["Prenom"].ToString(); naissance=dr["Date_naiss"].ToString(); lieu=dr["Lieu_naiss"].ToString(); sexe=dr["Sexe"].ToString(); situationfamille=dr["Situation_fam"].ToString(); personnecontact=dr["Personnecontact"].ToString(); idserv=dr.GetInt32(id_serv); idstatut=dr.GetInt32(id_statut); }
Partager