Created
July 6, 2017 14:54
-
-
Save jofese/aac798ef85da59f3599e15596ba0d98a to your computer and use it in GitHub Desktop.
Llenar un combobox por dataset c#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void LlenarComboMotivos() | |
| { | |
| try | |
| { | |
| //this.cbMotivo.Items.Clear(); | |
| this.cbMotivo.DataSource = null; | |
| OracleDataAdapter daEmp = new OracleDataAdapter("select IDMOT, MOTNUM||' : '||MOT AS MOT, MOTNUM, FECREG, USENAM, HOSTNAME from SIA_MOTIVOS order by MOTNUM asc", cls_DatosLolcli.cadenaconexion); | |
| DataSet dsEmp = new DataSet("SIA_MOTIVOS"); | |
| daEmp.Fill(dsEmp, "SIA_MOTIVOS"); | |
| DataTable dtEmp = dsEmp.Tables["SIA_MOTIVOS"]; | |
| DataRow[] drEmp = dsEmp.Tables["SIA_MOTIVOS"].Select(); | |
| if (dsEmp.Tables[0].Rows.Count > 0) | |
| { | |
| this.cbMotivo.DataSource = dsEmp.Tables[0].DefaultView; | |
| this.cbMotivo.DisplayMember = "MOT"; | |
| this.cbMotivo.ValueMember = "MOTNUM"; | |
| } | |
| } | |
| catch (Exception ex) | |
| { | |
| throw; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment