Esempio n. 1
0
        private void cempleado()
        {
            //metodo para consultar
            try
            {
                string     nit  = txtnit.Text;
                lbl_LN_EMP objL = new lbl_LN_EMP();
                objL.Nit = Convert.ToInt32(nit);
                if (!objL.Consultar(objL.Nit))
                {
                    MessageBox.Show(objL.Error);
                    objL = null;
                    return;
                }
                if (objL.ObjLeer.HasRows)
                {
                    objL.ObjLeer.Read();
                    txtnom.Text = objL.ObjLeer.GetString(1);
                    txtape.Text = objL.ObjLeer.GetString(2);
                    txttel.Text = objL.ObjLeer.GetString(3);
                    txtsal.Text = objL.ObjLeer.GetDecimal(4).ToString();

                    objL.ObjLeer.Close();
                }
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message);
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            int N;

            try
            {
                N = Convert.ToInt32(txtnit.Text);

                lbl_LN_EMP objL = new lbl_LN_EMP();
                objL.Nit = N;
                if (!objL.Consultar(objL.Nit))
                {
                    MessageBox.Show(objL.Error);

                    return;
                }
                else
                {
                    txtnom.Text = objL.Nit.ToString();
                    txtsal.Text = objL.Nombre.ToString();
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }