Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you save the data, guys?
Message
De
06/09/2005 12:35:02
 
 
À
06/09/2005 06:07:26
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 1.1
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01046932
Message ID:
01047064
Vues:
14
Grig,

Sometimes you need to do an .EndEdit() or an .EndCurrentEdit(). If you put this code:
this.BindingContext[dsBook].EndCurrentEdit();
before you save, you should see that dsBook.HasChanges() should now be true.

~~Bonnie

>Ok, here's the deal:
>
>A winform containing several textboxes. The textboxes are bound to a dataset through code like this:
>
>txtBookTitle.DataBindings.Add(new Binding("Text", dsBook, dsBook.Tables[0].ToString() + ".Title"));
>
>
>I change the textbox's contents, then in Save button I have the following:
>
>SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(BookDataAdapter);
>BookDataAdapter.UpdateCommand = cmdBuilder.GetUpdateCommand;
>BookDataAdapter.Update(dsBook, "Books");
>
>
>However, nothing happens. dsBook.HasChanges() returns false. Why? What I am missing and where to get this info from? I tried MSDN, but the examples I've found just say DbAdapter.Update(). Well.... i did that and it doesn't update. I have looked into UpdateCommand text, it looks ok. So it has to be something else. What?
>
>Thank you.
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