Text
I am creating a customer search application and looking for some advice. I enter customer id - 000000000001 into textbox click button to search. Data is binded via textboxes below correctly. When I attempt to re-enter new id e.g. 000000000054 in entry textbox, click search button, I receive error:
{This causes two bindings in the collection to bind to the same property.\r\nParameter name: binding"}
I tried to us dataset clear() method but does not work. What am I missing or what can I use to correct this.
public void button3_Click(object sender, EventArgs e)
{
string select = "select * from customer where master_customer_id=" + textBox3.Text;
string source = @"Data Source=DB;database=TTST;User id=sa;Password=;";
SqlConnection conn = new SqlConnection(source);
conn.Open();
//Use SqlDataAdapter to fill rows to dataset
SqlDataAdapter da = new SqlDataAdapter(select, conn);
DataSet ds = new DataSet();
da.Fill(ds, "Customer");
//Binding Data to Textbox Control
textBox1.DataBindings.Add("Text", ds, "customer.first_name");
textBox2.DataBindings.Add("Text", ds, "customer.last_name");
}
}
|