GagaCode 0 Light Poster

hey all i have another little issue it's regarding the databinding here and what i'm trying to do here is to get some data from access to my programme how ever the code only work for the first and when i try to invoke it again it give's me the error "This causes two bindings in the collection to bind to the same property."

see the below code :

 private void Label1_TextChanged(object sender, EventArgs e)
        {
            // the below Snippet is for Searching the database Access and Retirving it in the database
            if (Label2.Text == "EDIT")
            {
                using (AMSCONN)
                {
                    string UpdateString = "SELECT EmpCode,EfCode,Branch,SectorName,EmpType,SuperVisor,EmpName,Govenment,District,Area,Email,addrs FROM AddressBook WHERE EmpCode = '" + ForSearch.Text + "'";

                    }
                    AMSCONN.Open(); 
                    MessageBox.Show(ex.Message);
                    OleDbCommand UpdateCMD = new OleDbCommand(UpdateString, AMSCONN);
                    OleDbDataAdapter UpdateAD = new OleDbDataAdapter(UpdateCMD);
                    DataTable UpdateTable = new DataTable();
                    UpdateAD.Fill(UpdateTable);
                    AMSCONN.Close();
                    EmpTxt.DataBindings.Add("Text", UpdateTable, "EmpCode"); // here where it happened : ERROR : This causes two bindings in the collection to bind to the same property.
                    Sector_CB.DataBindings.Add("Text", UpdateTable, "SectorName");
                    FillDropDownList("SELECT SecCode,SecName FROM Sectors WHERE SecCode = " + Sector_CB.Text +"", Sector_CB, "SecCode", "SecName");  
                    Name_Txt.DataBindings.Add("Text", UpdateTable, "EmpName");
                    Branch_CB.DataBindings.Add("Text", UpdateTable, "Branch");
                }              
            }

So i tried to fix through useing couple of different approch like clearing the datainding of the text box but it dosent seem to work

so any idea's

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.