mail-archives/mono-bugs/2005-June/030265.html

192 строки
7.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 75227][Nor] New - DataSet.GetChanges() fails when
dataset includes deleted rows
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%2075227%5D%5BNor%5D%20New%20-%20DataSet.GetChanges%28%29%20fails%20when%0A%09dataset%20includes%20deleted%20rows&In-Reply-To=bug-75227%40chernobyl.ximian.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="030264.html">
<LINK REL="Next" HREF="030266.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 75227][Nor] New - DataSet.GetChanges() fails when
dataset includes deleted rows</H1>
<B>bugzilla-daemon at bugzilla.ximian.com</B>
<A HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%2075227%5D%5BNor%5D%20New%20-%20DataSet.GetChanges%28%29%20fails%20when%0A%09dataset%20includes%20deleted%20rows&In-Reply-To=bug-75227%40chernobyl.ximian.com"
TITLE="[Mono-bugs] [Bug 75227][Nor] New - DataSet.GetChanges() fails when
dataset includes deleted rows">bugzilla-daemon at bugzilla.ximian.com
</A><BR>
<I>Fri Jun 10 20:37:35 EDT 2005</I>
<P><UL>
<LI>Previous message: <A HREF="030264.html">[Mono-bugs] [Bug 75226][Nor] Changed - [PATCH] System.Data
cascading on update triggered too often
</A></li>
<LI>Next message: <A HREF="030266.html">[Mono-bugs] [Bug 75227][Nor] Changed - DataSet.GetChanges() fails
when dataset includes deleted rows
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#30265">[ date ]</a>
<a href="thread.html#30265">[ thread ]</a>
<a href="subject.html#30265">[ subject ]</a>
<a href="author.html#30265">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">george.barbarosie at gmail.com.</A>
<A HREF="http://bugzilla.ximian.com/show_bug.cgi?id=75227">http://bugzilla.ximian.com/show_bug.cgi?id=75227</A>
--- shadow/75227 2005-06-10 20:37:35.000000000 -0400
+++ shadow/75227.tmp.2597 2005-06-10 20:37:35.000000000 -0400
@@ -0,0 +1,118 @@
+Bug#: 75227
+Product: Mono: Class Libraries
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Sys.Data
+AssignedTo: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs at ximian.com</A>
+ReportedBy: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">george.barbarosie at gmail.com</A>
+QAContact: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs at ximian.com</A>
+TargetMilestone: ---
+URL:
+Cc:
+Summary: DataSet.GetChanges() fails when dataset includes deleted rows
+
+This happens only when there's a relation in the dataset.
+
+testcase:
+
+using System;
+using System.Data;
+
+class Test {
+ public static void Main() {
+ DataSet ds = new DataSet(&quot;testds&quot;);
+
+ DataTable tbl = ds.Tables.Add(&quot;parent&quot;);
+ DataColumn col = tbl.Columns.Add(&quot;id&quot;, typeof(int));
+ col.AutoIncrement = true;
+ col = tbl.Columns.Add(&quot;data&quot;, typeof(string));
+ col.AllowDBNull = false;
+ tbl.PrimaryKey = new DataColumn[] { tbl.Columns[&quot;id&quot;] };
+
+ tbl = ds.Tables.Add(&quot;child&quot;);
+ col = tbl.Columns.Add(&quot;id&quot;, typeof(int));
+ col.AutoIncrement = true;
+ col = tbl.Columns.Add(&quot;parent&quot;, typeof(int));
+ tbl.Columns.Add(&quot;data&quot;, typeof(string));
+ tbl.PrimaryKey = new DataColumn[] { tbl.Columns[&quot;id&quot;] };
+
+ ds.Relations.Add(&quot;child2parent&quot;,
+ ds.Tables[&quot;parent&quot;].Columns[&quot;id&quot;],
+ ds.Tables[&quot;child&quot;].Columns[&quot;parent&quot;]);
+
+ DataRow row = ds.Tables[&quot;parent&quot;].NewRow();
+ row[&quot;data&quot;] = &quot;something on parent&quot;;
+ ds.Tables[&quot;parent&quot;].Rows.Add(row);
+
+ row = ds.Tables[&quot;child&quot;].NewRow();
+ row[&quot;data&quot;] = &quot;something on child&quot;;
+ row[&quot;parent&quot;] = 0;
+ ds.Tables[&quot;child&quot;].Rows.Add(row);
+ ds.AcceptChanges();
+
+ row = ds.Tables[&quot;child&quot;].Rows.Find(0);
+ row.Delete();
+
+ try {
+ ds.GetChanges();
+ } catch (Exception e) {
+ Console.WriteLine(&quot;Exception caught (1):&quot;);
+ Console.WriteLine(e);
+ }
+
+ ds.RejectChanges();
+
+ row = ds.Tables[&quot;parent&quot;].Rows.Find(0);
+ row.Delete();
+
+ try {
+ ds.GetChanges();
+ } catch (Exception e) {
+ Console.WriteLine(&quot;Exception caught (2):&quot;);
+ Console.WriteLine(e);
+ }
+
+ }
+}
+
+Expected results: should not throw an exception;
+
+Actual results:
+
+Exception caught (1):
+System.Data.DeletedRowInaccessibleException: Deleted row information cannot
+be accessed through the row.
+in &lt;0x000ba&gt; System.Data.DataRow:IndexFromVersion (DataRowVersion version)
+in &lt;0x0014a&gt; System.Data.DataRow:GetParentRows (System.Data.DataRelation
+relation, DataRowVersion version)
+in &lt;0x00016&gt; System.Data.DataRow:GetParentRow (System.Data.DataRelation
+relation, DataRowVersion version)
+in &lt;0x00015&gt; System.Data.DataRow:GetParentRow (System.Data.DataRelation
+relation)
+in &lt;0x000b6&gt; System.Data.DataSet:AddChangedRow
+(System.Collections.Hashtable addedRows, System.Data.DataTable copyTable,
+System.Data.DataRow row)
+in &lt;0x00148&gt; System.Data.DataSet:GetChanges (DataRowState rowStates)
+in &lt;0x0000f&gt; System.Data.DataSet:GetChanges ()
+in &lt;0x00457&gt; Test:Main ()
+Exception caught (2):
+System.Data.DeletedRowInaccessibleException: Deleted row information cannot
+be accessed through the row.
+in &lt;0x000ba&gt; System.Data.DataRow:IndexFromVersion (DataRowVersion version)
+in &lt;0x0014a&gt; System.Data.DataRow:GetParentRows (System.Data.DataRelation
+relation, DataRowVersion version)
+in &lt;0x00016&gt; System.Data.DataRow:GetParentRow (System.Data.DataRelation
+relation, DataRowVersion version)
+in &lt;0x00015&gt; System.Data.DataRow:GetParentRow (System.Data.DataRelation
+relation)
+in &lt;0x000b6&gt; System.Data.DataSet:AddChangedRow
+(System.Collections.Hashtable addedRows, System.Data.DataTable copyTable,
+System.Data.DataRow row)
+in &lt;0x00148&gt; System.Data.DataSet:GetChanges (DataRowState rowStates)
+in &lt;0x0000f&gt; System.Data.DataSet:GetChanges ()
+in &lt;0x00514&gt; Test:Main ()
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="030264.html">[Mono-bugs] [Bug 75226][Nor] Changed - [PATCH] System.Data
cascading on update triggered too often
</A></li>
<LI>Next message: <A HREF="030266.html">[Mono-bugs] [Bug 75227][Nor] Changed - DataSet.GetChanges() fails
when dataset includes deleted rows
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#30265">[ date ]</a>
<a href="thread.html#30265">[ thread ]</a>
<a href="subject.html#30265">[ subject ]</a>
<a href="author.html#30265">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-bugs">More information about the mono-bugs
mailing list</a><br>
</body></html>