private void button4_Click(object sender, EventArgs e) { string elemntN, moduleN, enseignantN; elemntN = textBox1.Text; enseignantN = comboBox2.Text; moduleN = comboBox1.Text; DataTable dt1 = new DataTable(); dt1 = conn.query("select m.id_module,es.id_enseignant from Module m ,Enseignant es where m.nom_module='" + moduleN + "' and es.nom_enseignant='" + enseignantN + "'"); int n = (Int32)dt1.Rows[0]["id_module"]; int b = (Int32)dt1.Rows[0]["id_enseignant"]; DataGridViewRow selectedRow = dataGridView1.Rows[index]; string vv = "update Element set nom_element='" + elemntN + "',id_module='" + n + "',id_enseignant='" + b + "' where id_element='" + selectedRow.Cells[0].Value.ToString() + "'"; /* MessageBox.Show(vv);*/ conn = new connection(); conn.conn.Open(); SqlCommand re = new SqlCommand(vv, conn.conn); re.ExecuteNonQuery(); // conn.execute_query("update Element set nom_element ='"+elemntN+"' where id_element ='"+vv+"'"); MessageBox.Show("Bien modifier"); refreshGrid(); }
public admin_acceuil(int id) { InitializeComponent(); cn = new connection(); this.ida = id; DataTable dt = cn.query("select * from Administrateur where id_admin='" + ida + "'"); nom = (string)dt.Rows[0]["nom"]; prenom = (string)dt.Rows[0]["prenom"]; username = (string)dt.Rows[0]["admin_username"]; email = (string)dt.Rows[0]["email"]; portable = (string)dt.Rows[0]["portable"]; }