[Mono-bugs] [Bug 67317][Nor] New - SystemData.DataTable.ImportRow() fails when Constraints are set

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 1 Oct 2004 07:59:33 -0400 (EDT)


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 tha@adv.magwien.gv.at.

http://bugzilla.ximian.com/show_bug.cgi?id=67317

--- shadow/67317	2004-10-01 07:59:33.000000000 -0400
+++ shadow/67317.tmp.21837	2004-10-01 07:59:33.000000000 -0400
@@ -0,0 +1,66 @@
+Bug#: 67317
+Product: Mono: Class Libraries
+Version: unspecified
+OS: other
+OS Details: fedora core 2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: tha@adv.magwien.gv.at               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: SystemData.DataTable.ImportRow() fails when Constraints are set
+
+Mono Runtime: 1.0.2
+
+Description of Problem:
+
+If a row is to be imported into a DataTable with Constraints (e.g. 
+PrimaryKey) with ImportRow() an Exception is raised.
+
+
+Steps to reproduce the problem:
+1. Create a Console Application
+2. Copy the following lines to Main():
+			DataTable dt=new DataTable("test");
+			DataColumn pk= dt.Columns.Add("ID", typeof(int));
+			dt.Columns.Add("text", typeof(string));
+
+			dt.PrimaryKey=new DataColumn[] {pk};
+
+			DataRow row=dt.NewRow();
+			row["ID"]=1;
+			row["text"]="testtxt";
+
+			dt.ImportRow(row);
+
+			Console.Write("Everything ok. <Return to End>");
+			Console.Read();
+
+3. run the proggie
+
+Actual Results:
+A System.Data.NoNullAllowedException is raised.
+
+Expected Results:
+No Exception. The Screen should read "Everything ok. <Return to End>".
+
+How often does this happen? 
+always
+
+Additional Information:
+
+In the sources for DataTable.ImportRow() (from 09/19/2004) a new Row is 
+created and added to the DataTable immediately. After that the values are 
+copied. 
+
+Shouldn't the values be copied first to avoid constraint violations?
+
+Thanks and have a nice day
+
+Theo