I'm trying to fill a ComboBox
from a db
, but ComboBox
is populated 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 is where all the information in the NomeInv
field, including repeated, is coming.
Is there any code to prevent this?