When I run this it doesnt fill items in my combo box.
public void FILLREPRESENTATIVE()
{
try // fill combobox Party with corresponding Representative Section
{
MySqlCommand command = new MySqlCommand("SELECT CONCAT(Firstname,' ',LastName) AS Full_Name, Section,
Position FROM candidatetable WHERE Section='"+lblSection.Text+"' AND Position= 'Representative'", connection);
connection.Open();
MySqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
cbRepresentative.Items.Add(reader.GetString("Full_Name"));
}
connection.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
If I use this kind of code: Section='ict' it fills my combo box. But I wanted to use the label text for my Section.