Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

MultiColumn ComboBox won't display any data if i have only 1 record in the database.

$
0
0

Hello All,

 I am having a problem with my MultiColumn ComboBox. I programmed my MultiColumn ComboBox to get data from my SQL database.. But if I have only one record on my database table, my comboBox shows nothing..If I add a new record to the table..my comboBox only shows one record. Generally, the comboBox doesn't display the first record inserted to my database table.

 Here's my code for fetching data from my database to the multicolumnComboBox:

 

 private void populate_cmbMembers()
        {
            string strsql = string.Format("SELECT member_id AS 'MEMBER ID',completeName AS 'MEMBER NAME' FROM viewMembers ORDER BY                  completeName ASC");
            using (SqlConnection connection = new SqlConnection(Globals.connectionString))

                try
                {
                    using (SqlCommand cmd = new SqlCommand(strsql, connection))
                    {
                        connection.Open();
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                cmbReferrer.EditorControl.MasterTemplate.LoadFrom(reader);
                                this.cmbReferrer.MultiColumnComboBoxElement.DropDownWidth = 500;
                                this.cmbReferrer.MultiColumnComboBoxElement.DropDownHeight = 200;

                            }
                            reader.Close();
                        }
                    }
                }
                catch (Exception ex) { MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }

 

Any help would be greatly appreciated. Thank You.


Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>