Bonjour donc voila , j'essaie par le biais d'une winform de modifier ma base de données en sélectionnant selon le nom la ligne à modifier
je cherche pour des raisons de simplicités d'afficher les résultats dans des textbox
donc voici mon code actuel peu concluant ,la connexion serai bonne donc il s'agirait d'un problème de lecture :
Voila la forme de base sur laquelle je m'appuyais.
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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 textmodnom.Text = comboBoxmod.Text; string connectionString = null; try { connectionString = Properties.Settings.Default.gestionConnectionString; } catch (System.Exception exe) { System.Windows.Forms.MessageBox.Show(exe.Message); } try { using (SqlConnection connexion = new SqlConnection(connectionString)) { connexion.Open(); SqlCommand sqlCommand1 = new SqlCommand("Select Unites ,Prenom from utilisateur where Nom = @Non_choix ", connexion); //---------------------------------------combo_box => @Nom_choix---------------- sqlCommand1.Parameters.Add( "@Non_choix", SqlDbType.VarChar); sqlCommand1.Parameters[ "@Non_choix"].Value = comboBoxmod.Text; //------------------------------------------------------------------------------- ReadSQL = sqlCommand1.ExecuteReader(); //read sql serai hors context ReadSQL.Read(); textmodunites = ReadSQL.GetValue(0); textmodprenom = ReadSQL.GetValue(1); sqlCommand1.ExecuteNonQuery(); } }
Si on peut m'éclairai Merci .
Partager