hhnetworks
asked on
C# Winform Table Adapter suddenly not saving to DB
I have a C# Winform app that I wrote a couple of months ago that has been working fine, but recently has ceased to update my database when Im calling the TableAdapter.Update function. I have this in a try / catch block, and it is not throwing any errors. If I put a Breakpoint on the Update line, I can see all my new values in the various form fields, but it again it doesnt throw any exceptions. My connection string to the DB must be good because my Fill query works.
Below is my code:
Any ideas are appreciated.
Below is my code:
private void SaveButton_Click(object sender, EventArgs e)
{
try
{
this.Validate();
this.taEditBindingSource.EndEdit();
this.taEditTableAdapter.Update(this.ONLINE_STOREDataSet.taEdit);
var form = new SaveConfirmed(); //Displays my Custom Confirmation Box
form.Show();
}
catch (System.Exception ex)
{
MessageBox.Show("Update failed:\n" + ex);
}
}
Any ideas are appreciated.
Does the DataSet have any changes when the Update is called?
ASKER
I believe so. When I enter or change data in the List View and if I put a breakpoint at Line 7 in the code above, I can drill into the dataset in debugger and see changes Ive made in the various fields
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Bob.
Additional debugging revealed that I had an Event Handler elsewhere that was calling the Fill function of my dataset before changes were being saved.
Additional debugging revealed that I had an Event Handler elsewhere that was calling the Fill function of my dataset before changes were being saved.