con.Open();
cmd = new OleDbCommand("Select DISTINCT departmentName from Department", con);
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
comboBoxDepartment.DisplayMember = "departmentName";
comboBoxDepartment.ValueMember = "departmentName";
comboBoxDepartment.DataSource = dt;
con.Close();
cmd = new OleDbCommand("Select DISTINCT departmentName from Department", con);
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
comboBoxDepartment.DisplayMember = "departmentName";
comboBoxDepartment.ValueMember = "departmentName";
comboBoxDepartment.DataSource = dt;
con.Close();
No comments:
Post a Comment