Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to detect changes?
Message
De
12/10/2003 15:38:35
 
 
À
12/10/2003 15:25:58
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00837935
Message ID:
00837936
Vues:
33
This message has been marked as a message which has helped to the initial question of the thread.
Ritesh,

The reason that .HasChanges() is sometimes flaky has to do with whether an .EndEdit() has been done on the Data and in some cases this has to be done manually. Typically what I'll do is something like this before I look for .HasChanges() (code off the top of my head, since I don't have my .NET computer here ... so the syntax may be off a little):
for (int nTable = 0; nTable < ds.Tables.Count; nTable++)
{
	for (int nRow = 0; nRow < ds.Tables[nTable].Rows.Count; nRow++)
	{
		if (ds.Tables[nTable].Rows[nRow].HasVersion(DataRowVersion.Proposed))
		{
			ds.Tables[nTable].Rows[nRow].EndEdit();
		}
	}
}
After that, .HasChanges() will correctly be true if there were any.

~~Bonnie


>Hi! All,
>
>I have created connection, data-adapter and dataset. I have binded all the textboxes and comboBoxes with dataset at design time.
>
>As far as navigation is concern, every thing is good and nice. But, what if user changes any of the values in textboxes or comboBoxes?
>
>I want to display a messagebox asking for a confirmation about the changes the user has made before moving to next record or applying filter, find or sort operations.
>
>The problem is, How to know whether user has changed any of the values, as dsFoo.HasChanges() dosen't work while applying sort, filter or find? Also, as per my experience, dsFoo.HasChanges() gives true value after moving to next record. Hence, the values in Binded Controls are changed when messagebox popups.
>
>Any suggestion regarding approach is also welcomed.
>
>Thanks in adv.
>
>Ritesh.
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