Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie - Problem Updating! - getting desperate!
Message
From
22/12/2003 12:58:20
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00861305
Message ID:
00861345
Views:
26
Rick,

Here's the steps you need to do:

1) Databind your controls ... it sounds like you've done this already.

2) Before running the .Update() method, you need to verify that all proposed changes have been marked as modified rather than proposed ... there are two ways of doing this:
// for each table:
this.BindingContext[MyDataTable}.EndCurrentEdit();
or
for (int i=0; i < MyDataSet.Tables.Count; i++)
{
  for (int j=0; j < MyDataSet.Tables[i].Rows.Count; j++)
  {
    if (MyDataSet.Tables[i].Rows[j].HasVersion(DataRowVersion.Proposed))
      MyDataSet.Tables[i].Rows[j].EndEdit();
  }
}
I've had problems occasionally with the simpler method above (and it may just be something I didn't understand in the earlier days), and so I do the other one instead.

3) After the .Update() completes successfully, the do:
MyDataSet.AcceptChanges();
Hope that helps,
~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform