Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you save the data, guys?
Message
De
06/09/2005 20:02:40
 
 
À
06/09/2005 19:44:15
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:
01047210
Vues:
10
You're welcome Grig!! =)

~~Bonnie



>Thank you so much, Bonnie :)
>
>Three stars here :)
>
>>Grig,
>>
>>As to why it happens sometimes and not others, I don't know and haven't ever really taken the time to pinpoint which circumstances cause it ... and, to be honest, suggesting you do a BindingContext[].EndCurrentEdit() is probably not a good suggestion either ... I have found that sometimes it does not work (does not cause the ds.HasChanges() to become true). The DataRow.EndEdit() method seems to work much better. Here's a method that I have coded into my base Form class to check for this particular problem. I always call it before I do a save:
>>
>>protected virtual void ForceChangedRows(DataSet ds)
>>{
>>	if (ds == null)
>>		return;
>>
>>	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();
>>			}
>>		}
>>	}
>>}
>>
>>
>>~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform