SqlCommand sqlcmd = new SqlCommand("select * from stagiaire where Id_stagiaire=@Id_stagiaire", sqlcon);
SqlParameter sqlpr1 = new SqlParameter();
sqlpr1.ParameterName = "@Id_stagiaire";
sqlpr1.DbType = System.Data.DbType.Int16;
sqlpr1.Direction = System.Data.ParameterDirection.Input;
sqlpr1.Value = this.txtID.Text.ToString();
sqlcmd.Parameters.Add(sqlpr1);
sqlcon.Open();
sqldr = sqlcmd.ExecuteReader();
if (sqldr.Read())
{
this.txtNom.Text = sqldr.GetString(1).ToString();
this.txtPrenom.Text = sqldr.GetString(2).ToString();
this.CmbSp.Text = sqldr.GetString(3).ToString();
if (sqldr.GetString(4).ToString()=="Feminin")
this.OppFemale.Checked=true;
else
{
this.oppMale.Checked=true;
}
this.txtAdrs.Text = sqldr.GetString(5).ToString();
this.dateTimePicker1.Value = sqldr.GetDateTime(6);
}
else
{ MessageBox.Show("Ce ID Stagiaire N'existe pas dans la list des Stagiaires !");
}
sqlcon.Close();