Saqib Malick

Saqib Malick

  • NA
  • 23
  • 0

How to bind combo box with selected query

Dec 26 2009 11:07 AM
Hello,

I have a combo box in my form, where I want to populate the list of employee name whose Designation is "Accountant"

I am using three tables a

<< Account_Dept_Table >>
Acc_ID (P.K)
Emp_ID (F.K)


<< Emp_Info_Table >>
Emp_ID (P.K)
Emp_Name
Designation_ID (F.K)

<< Designation_Table >>
Designation_ID (P.K)
Designation




Code:
//As I am using Data Bound wizard in Comb Box Task but not success here the back end code is following:

this.emp_IdComboBox.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.teacher_Information_MasterBindingSource, "Emp_Id", true));
            this.emp_IdComboBox.DataSource = this.tableEmployeeInformationBindingSource;
            this.emp_IdComboBox.DisplayMember = "emp_name";
            this.emp_IdComboBox.Name = "emp_IdComboBox";
            this.emp_IdComboBox.ValueMember = "emp_ID";


//and this code is in form back end:
          
               this.table_Employee_InformationTableAdapter.Fill(this.school_DatabaseDataSet_Employee_Information.Table_Employee_Information);
          

Answers (5)