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.