Exemple #1
0
        private void Form2_Load(object sender, EventArgs e)
        {
            tipo.Items.Add("MEDICO");
            tipo.Items.Add("ENFERMERIA");
            tipo.Items.Add("GENERAL");

            SqlDataReader Lect;

            using (SqlConnection Cone = Conexion.generarConexion())
            {
                Cone.Open();
                SqlCommand comando = new SqlCommand("SELECT [Nombre],[FechaIngreso],[TipoEmpleado],[TipoContrato],[TieneProfilactica], IDEmpleado FROM Empleado where Nombre = '" + nombre.Text + "'", Cone);

                Lect = comando.ExecuteReader();

                while (Lect.Read())
                {
                    fecha1.Value = Lect.GetDateTime(1);

                    tipo.SelectedIndex = Lect.GetInt32(2) - 1;

                    if (Lect.GetString(3) == "P")
                    {
                        radP.Checked = true;
                    }
                    else
                    {
                        radC.Checked = true;
                    }

                    if (Lect.GetString(4) == "SI")
                    {
                        radsi.Checked = true;
                    }
                    else
                    {
                        radno.Checked = true;
                    }

                    idEmp = Lect.GetInt32(5);
                }
                Cone.Close();
            }
        }