Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Newbie - Problem Updating! - getting desperate!
Message
De
22/12/2003 12:58:20
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00861305
Message ID:
00861345
Vues:
25
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform