Ver código fonte

* DataTable.cs (RowsExist): Check rows based on version.

svn path=/trunk/mcs/; revision=65911
Nagappan Alagappan 19 anos atrás
pai
commit
d4ded636e0

+ 2 - 0
mcs/class/System.Data/System.Data/ChangeLog

@@ -1,5 +1,7 @@
 2006-09-26  Nagappan A  <[email protected]>
 
+	* DataTable.cs (RowsExist): Check rows based on version.
+
 	* DataRow.cs: Raise exception same as MS.NET. Thanks to
 	Hubert FONGARNAND <[email protected]> for
 	providing this patch.

+ 5 - 1
mcs/class/System.Data/System.Data/DataTable.cs

@@ -697,7 +697,11 @@ namespace System.Data {
 					if (thisRow.RowState != DataRowState.Deleted) {
 						bool match = true;
 						// check if the values in the columns are equal
-						int thisIndex = thisRow.IndexFromVersion(DataRowVersion.Current);
+						int thisIndex = -1;
+						if (thisRow.RowState == DataRowState.Modified)
+							thisIndex = thisRow.IndexFromVersion(DataRowVersion.Original);
+						else
+							thisIndex = thisRow.IndexFromVersion(DataRowVersion.Current);
 						foreach (DataColumn column in columns) {
 							if (column.DataContainer.CompareValues(thisIndex, index) != 0) {
 								match = false;