bonjour,
je vous prix de m' aider
je vais vous expliquer mon probleme:
j ai une table matiere dans ma base en sql server où il y avait un attribut prix de type float
dans mon application
1:je veux créer un textbox qui accepte du type float
2:pour le bouton consulter j ai une erreur:
ERREUR:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 string req = "select * from matiere where Ref_matiere=" + reference.Text + " "; SqlCommand cmd = new SqlCommand(req,cnx); SqlDataReader r = cmd.ExecuteReader(); r.Read(); //remplissage des champs categorie.Text = (string)r["Categorie_matiere"]; designation.Text = (string)r["Designation_matiere"]; type.Text = (string)r["Type_matiere"]; prix.Text = (float) r["Prix_matiere"]; couleur.Text = (string)r["Couleur_matiere"]; composition.Text = (string)r["Composition"]; }
Erreur 2 Impossible de convertir implicitement le type 'float' en 'string'
Merci de m'aider svp.
Partager