1
I’m trying to fill one ComboBox
from a db
, but the ComboBox
is filled with many repeated items!
OleDbConnection Con = new OleDbConnection();
Con.ConnectionString = Properties.Settings.Default.dbCombo;
Con.Open();
OleDbCommand Cmm = new OleDbCommand();
Cmm.CommandText = "SELECT NomeInv FROM tbFev;
Cmm.CommandType = CommandType.Text;
Cmm.Connection = Con;
OleDbDataReader DR;
DR = Cmm.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(DR);
DataView dv = new DataView(dt, "", "NomeInv", DataViewRowState.OriginalRows);
comboBox1.DataSource = dv;
comboBox1.DisplayMember = "NomeInv";
comboBox1.ValueMember = "";
Con.Close();
This way is coming all the information from the field NomeInv
, even repeated.
Is there a code to prevent this ?
I put as an answer Maurice, to stay in the right place and as answered your question.
– Bruno Bermann