Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why my .GetChanges() does not work?
Message
 
 
À
26/01/2010 09:39:05
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01445923
Message ID:
01445973
Vues:
21
You bet I will have more questions. I should be an MVP of questions. Or Person of the Year for newbie questions <g>.

>Glad to help, Dmitry. Keep the questions coming (I know you will! <g>)
>
>~~Bonnie
>
>
>>Hi Bonnie,
>>
>>Thank you for the solution. This was exactly what I was missing. I might have even read the entry in your blog about this before but until you actually need it, hard to remember and focus on everything. I also found an entire section in my book on WinForm binding on the EndEdit with a long explanation.
>>
>>Thank you for your help!
>>
>>>Hey Dmitry,
>>>
>>>I'm assuming that a similar thing happens in ASP.NET as in WinForms when binding to a DataSet (keep in mind that I know very little about ASP).
>>>
>>>Here's probably what the problem is:
>>>
>>>Data in a DataRow has several different versions. First, there's the original version. Then, when it's being edited (either in a UI control, like a TextBox or programmatically), it has a Proposed version and once it's done being edited, that becomes the Current version. Sometimes when entering data in a UI control, the row is left in the Proposed state and the Edit needs to be ended programmatically. This doesn't always happen and I'm not entirely sure why it's seemingly random (maybe it's an ADO.NET bug).
>>>
>>>The above blurb is the first paragraph of one of my blog posts covering this topic: http://geek-goddess-bonnie.blogspot.com/2009/09/fun-with-datasets.html. Basically you need to commit those proposed changes. See my blog post for the details.
>>>
>>>~~Bonnie
>>>
>>>
>>>
>>>>>Hi,
>>>>>
>>>>>I have a form with controls (textboxes) bound to a typed dataset oMyDs. I change a value in one of the text boxes and click on a button (created for testing). In the click method of this form I do the following:
>>>>>
>>>>>
>>>>>DataSet dsChanges = oMyDs.GetChanges(DataRowState.Modified);
>>>>>
>>>>>
>>>>>Then I inspect the value of dsChanges and it is NULL. What am I missing?
>>>>
>>>>UPDATE TO MY INITIAL MESSAGE: I think (maybe) the reason dsChanges gets NULL value is that there are no changes in the dataset. I wrote a few lines of code checking the .current and .original values for all columns in the row where I made the change but the values are the same. I must be doing something wrong in the way I bind the textboxes. Here is my code of binding the testbox to the typed dataset:
>>>>
>>>>
>>>>this.txtTextBoxName.DataBindings.Add("Text", bindingSource1, "ColumnName");
>>>>
>>>>
>>>>The values from the dataset/datatable do appear in the text boxes. But could it be that the changes do not get updated back to the dataset?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform