I'm relatively new to Windows Forms and having trouble getting a form with multiple text fields to update the database.
I fill the dataset, add the data binding to each field and add a leave event to each field that updates the database.
clientsTableAdapter.FillByID(dataSetClients.Clients, tempID);
txtForename.DataBindings.Add("Text", dataSetClients.Clients, "Forename");
txtForename.Leave += new EventHandler(updateDataSet);
private void updateDataSet(object sender, EventArgs e)
{
this.clientsTableAdapter.Update(this.dataSetClients.Clients);
}
The database does not update, I have tried this in many different ways and the only way that seems to work is if I update the dataset manually then run .update() on the adapter, like so;
this.dataSetClients.Clients.Rows[0]["Forename"] = "New Forename";
this.clientsTableAdapter.Update(this.dataSetClients.Clients);
Any help or guidance on the subject is greatly appreciated.