private void cargar_datagridview1()
        {
            SqlClass ls_cadena  = new SqlClass();
            DataSet  lds_tablas = new DataSet();

            ls_cadena.adapter("SELECT id_cliente AS ID, nombre AS NOMBRE, apellido AS APELLIDO, email AS EMAIL, nit AS NIT FROM clientes", ls_cadena.conexion()).Fill(lds_tablas);
            dataGridView1.AutoGenerateColumns = true;
            dataGridView1.DataSource          = lds_tablas.Tables[0];
            dataGridView1.ClearSelection();
        }
        private void NuevoEmpleado_Load(object sender, EventArgs e)
        {
            SqlClass   obj_sql = new SqlClass();
            SqlCommand resultado;

            // 1. Traemos el último id disponible de la tabla Empleados
            try
            {
                resultado = obj_sql.sqlquery(
                    "SELECT MAX(id_empleado + 1) FROM empleados",
                    obj_sql.conexion()
                    );

                string id = resultado.ExecuteScalar().ToString();
                if (id == "")
                {
                    txt_id.Text    = "1";
                    txt_id.Enabled = false;
                }
                else
                {
                    txt_id.Text    = id;
                    txt_id.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            // 2. Luego traemos todos los departamentos para mostrarlos en el combobox
            try
            {
                DataSet dataset = new DataSet();

                SqlDataAdapter adapter = obj_sql.adapter(
                    "SELECT id_tipo_empleado AS id, tipo AS tipo FROM tipo_empleados",
                    obj_sql.conexion()
                    );

                adapter.Fill(dataset);
                adapter.Dispose();

                combo_tipoemp.DataSource    = dataset.Tables[0];
                combo_tipoemp.ValueMember   = "id";
                combo_tipoemp.DisplayMember = "tipo";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void Cliente_Load(object sender, EventArgs e)
 {
     try
     {
         SqlClass obj_sql     = new SqlClass();
         DataSet  obj_dataset = new DataSet();
         obj_sql.adapter(
             "SELECT id_cliente AS ID, nombre AS NOMBRE, apellido AS APELLIDO, email AS EMAIL, nit AS NIT FROM clientes",
             obj_sql.conexion()
             ).Fill(obj_dataset);
         dataGridView1.AutoGenerateColumns = true;
         dataGridView1.DataSource          = obj_dataset.Tables[0];
         dataGridView1.ClearSelection();
     }catch (Exception ex) {
         MessageBox.Show(ex.Message);
     }
 }
        private void NuevoCliente_Load(object sender, EventArgs e)
        {
            SqlClass   obj_sql = new SqlClass();
            SqlCommand resultado;

            // 1. Traemos el último id disponible de la tabla Clientes
            try
            {
                resultado = obj_sql.sqlquery(
                    "SELECT MAX(id_cliente + 1) FROM clientes",
                    obj_sql.conexion()
                    );

                txt_id.Text    = resultado.ExecuteScalar().ToString();
                txt_id.Enabled = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            // 2. Luego traemos todos los departamentos para mostrarlos en el combobox
            try {
                DataSet dataset = new DataSet();

                SqlDataAdapter adapter = obj_sql.adapter(
                    "SELECT id_departamento, nombre FROM departamentos",
                    obj_sql.conexion()
                    );

                adapter.Fill(dataset);
                adapter.Dispose();

                combo_departamentos.DataSource    = dataset.Tables[0];
                combo_departamentos.ValueMember   = "id_departamento";
                combo_departamentos.DisplayMember = "nombre";
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
        private void Empleado_Load(object sender, EventArgs e)
        {
            try
            {
                SqlClass obj_sql     = new SqlClass();
                DataSet  obj_dataset = new DataSet();

                obj_sql.adapter(
                    "SELECT e.id_empleado AS ID, e.nombre AS NOMBRE, e.apellido AS APELLIDO, e.email AS CORREO, " +
                    "e.telefono AS TELEFONO, t.tipo AS CARGO FROM empleados e " +
                    "INNER JOIN tipo_empleados t ON e.id_tipo_empleado=t.id_tipo_empleado;",
                    obj_sql.conexion()
                    ).Fill(obj_dataset);
                dataGridView1.AutoGenerateColumns = true;
                dataGridView1.DataSource          = obj_dataset.Tables[0];
                dataGridView1.ClearSelection();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }