public void Consultar() { _ = new DataTable(); string sentencia = "Select StrReferencia From TBLCATEGORIA_PROD where idCategoria=" + cbCategoria.SelectedValue.ToString(); Acceso_datos Acceso = new Acceso_datos(); DataTable dt = Acceso.EjecutarComandoDatos(sentencia); if (dt.Rows.Count > 0) { txtReferencia.Text = dt.Rows[0]["StrReferencia"].ToString(); } else { MessageBox.Show("No se dispone de datos de ingreso"); txtReferencia.Text = ""; } }
public void Consultar() { _ = new DataTable(); string sentencia = "Select StrUsuario, StrClave From TBLSEGURIDAD where IdEmpleado=" + cbEmpleado.SelectedValue.ToString(); Acceso_datos Acceso = new Acceso_datos(); DataTable dt = Acceso.EjecutarComandoDatos(sentencia); if (dt.Rows.Count > 0) { txtUsuario.Text = dt.Rows[0]["StrUsuario"].ToString(); txtClave.Text = dt.Rows[0]["StrClave"].ToString(); } else { MessageBox.Show("El usuario no dispone de datos de ingreso"); txtUsuario.Text = ""; txtClave.Text = ""; } }