I have a datagrid on a windows form with a bindingnavigator. The
tableadapter, bindingsource and dataset are there also.
I can browse and edit data normally.
I had added the "click" event to the "save" button on the navigator's
toolstrip.
I would like to have the data for the datagrid's table(or tables if it
is a joined recordset) to be updated to the SQL Server table that is
being displayed in the grid.
I used the following code...
private void saveToolStripButton_Click(object sender, EventArgs
e)
{
try
{
this.Validate();
this.partyBindingSource.EndEdit();
this.partyTableAdapter.Update(this.storeDataSet.Pa rty);
MessageBox.Show("Update successful");
}
catch (System.Exception ex)
{
MessageBox.Show("Update failed");
}
}
}
}
I compared my changes to the SQL table and the changes were there, but
the default values and the values on the fields set by an UPDATE
trigger did not show up.
BTW, the triggers and defaults work when editing in Enterprise Manager
or Query Analyser.
Any ideas?
Also, would this be a good place to call the "Fill" method on the table
adapter to refresh the records after the save/update? (assuming the
triggers and default values work, there would be something to see when
the refresh occurs)
TIA