Good day, I have an error with my project, it turns out that in my combobox I have registered 4 products, but when I change the selection and return to it, these products are duplicated, how can I correct that? I'm working on windows form linked to a MYSQL database
string consulta = string.Format("Select precio from productos where nombre='Pacifica012'");
string consulta2 = string.Format("Select precio from productos where nombre='GRG170DX'");
string consulta3 = string.Format("Select precio from productos where nombre='Stratocaster S'");
//MessageBox.Show(consulta);
MySqlCommand comando = new MySqlCommand(consulta, conexion);
MySqlCommand comando2 = new MySqlCommand(consulta2, conexion2);
MySqlCommand comando3 = new MySqlCommand(consulta3, conexion3);
MySqlDataReader lector = comando.ExecuteReader();
MySqlDataReader lector2 = comando2.ExecuteReader();
MySqlDataReader lector3 = comando3.ExecuteReader();
while (lector.Read())
{
textBox5.Text = lector.GetString(0);
}
while (lector2.Read())
{
textBox5.Text = lector2.GetString(0);
}
while (lector3.Read())
{
textBox5.Text = lector3.GetString(0);
}