Professional Documents
Culture Documents
SelectCommand = new SqlCommand("select * from Stagiaire", cn); da.Fill(ds, "Stagiaire"); Affichage(); // Affichage() txtNum.Text = ds.Tables[0].Rows[pos][0].ToString(); txtNom.Text = ds.Tables[0].Rows[pos][1].ToString(); txtPrenom.Text = ds.Tables[0].Rows[pos][2].ToString(); txtDate.Text = ds.Tables[0].Rows[pos][3].ToString();
//premier pos = 0; Affichage(); //precedent if(pos>0) pos --; Affichage(); // suivant if (pos <ds.Tables[0].Rows.Count-1) pos++; Affichage(); // dernier pos = ds.Tables[0].Rows.Count - 1; Affichage(); // NouveauStagiaire foreach (Control c in this.groupBox1.Controls) { if (c is TextBox) ((TextBox)c).Clear(); } // Ajouter DataRow dr = ds.Tables[0].NewRow(); dr[0] dr[1] dr[2] dr[3] = = = = int.Parse(txtNum.Text); txtNom.Text; txtPrenom.Text; txtDate.Text;
ds.Tables[0].Rows.Add(dr);
// SupprimerStagiaire ds.Tables[0].Rows[pos].Delete(); SqlCommandBuilder bl = new SqlCommandBuilder(da); da.Update(ds, "Stagiaire"); // ModifierStagiaire ds.Tables[0].Rows[pos].BeginEdit(); //ds.Tables[0].Rows[pos][0]=txtNum.Text; ds.Tables[0].Rows[pos][1]=txtNom.Text; ds.Tables[0].Rows[pos][2]=txtPrenom.Text; ds.Tables[0].Rows[pos][3] = txtDate.Text; ds.Tables[0].Rows[pos].EndEdit(); //enregistrer SqlCommandBuilder bl = new SqlCommandBuilder(da); da.Update(ds, "Stagiaire");