Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database update on formclosing

Status
Not open for further replies.

goneWildCoder

Programmer
May 26, 2004
20
US
I want to ensure that the changes made to a dataset are updated to the table when the form is closed so that any uncommitted changes are taken care of. Here is my form closing event method -->

private void DivFrmClosing(object sender, System.ComponentModel.CancelEventArgs e)
{

DataSet changedData = dataSet11.GetChanges();
if (changedData != null)
i = dbUpdate(); // method to update table
...
..

}

For some reason, changedData remains null even when I have uncommitted changes in the dataset. I am using similar code for the OK button and it works just fine.

Please help !!
 
try
Code:
if (dataSet11.HasChanges)
i = dbUpdate();   // method to update table
 
DaZZleD

I tried it... both HasChanges() and GetChanges() would update the first row only (and this is done only when i add multiple rows). If i add only 1 row, it does not update.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top