Trying to load a combobox dynamically with the following piece of code.
count gives exact number of rows !!, but the combobox does not show anything..!!.
Any help is greatly appreciated.
Code:public void loadComboBox(OdbcConnection con) { con = getConnection(); con.Open(); string str = "select distinct mgrCode from MgrDetail"; OdbcCommand nonqueryCommand = con.CreateCommand(); nonqueryCommand.CommandText = str; nonqueryCommand.CommandType = CommandType.Text; OdbcDataReader thisReader = nonqueryCommand.ExecuteReader(); DataSet ds = new DataSet(); DataTable dTable = new DataTable("TableA"); dTable.Load(thisReader); ds.Tables.Add(dTable); this.ComboBox1.DataSource = ds.Tables[0]; int count = this.ComboBox1.Items.Count; //count gives exact number of rows !! con.Close(); }




Reply With Quote