[Mono-bugs] [Bug 47915][Nor] New - After adding a row to a MySQL DataSet, update B.D. fails

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 16 Jun 2004 06:45:18 -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 tsureshkumar@novell.com.

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

--- shadow/47915	2004-06-16 06:45:18.000000000 -0400
+++ shadow/47915.tmp.26135	2004-06-16 06:45:18.000000000 -0400
@@ -0,0 +1,98 @@
+Bug#: 47915
+Product: Mono: Class Libraries
+Version: unspecified
+OS: unknown
+OS Details: 
+Status: RESOLVED   
+Resolution: FIXED
+Severity: Unknown
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: sergio-blanco@iespana.es               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: After adding a row to a MySQL DataSet, update B.D. fails
+
+I have code that fails, it does a consult to a MySQL using
+DataSets and adds a new Row to that DataSet. It fails when it tries to
+update the Data Base with "da.Update(ds, "personas");":
+
+/////////////// BEGIN CODE ///////////////
+ using System;
+ using System.Data;
+ using ByteFX.Data.MySQLClient;
+ 
+ public class Test 
+ {
+    public static void Main(string[] args)
+    {
+         string connectionString = 
+            "Server=localhost;" +
+            "Database=monotest;" +
+            "User ID=mono;" +
+            "Password=XXXXX;";
+
+         /* personas is a table with 2 string columns: firstname, lastname*/
+         MySQLConnection conn = new MySQLConnection(connectionString);
+         MySQLDataAdapter da = new MySQLDataAdapter("select * from
+personas",  conn);
+         DataSet ds = new DataSet();
+         da.Fill(ds, "personas");
+
+         DataTable dt = ds.Tables["personas"];
+         
+         //CREATE A NEW ROW
+         DataRow nuevaFila = dt.NewRow();
+         nuevaFila["firstname"] = "Pepe";
+         nuevaFila["lastname"] = "Salvador";
+         dt.Rows.Add(nuevaFila);
+         
+         // now perform the update
+         MySQLCommandBuilder cb = new MySQLCommandBuilder(da);
+         da.Update(ds, "personas"); 
+    }
+ }
+/////////////// END CODE ///////////////
+
+To compile the code above:
+
+$ mcs -r:System.Data -r:ByteFX.Data mysql-dataset-bug.cs
+Compilation succeeded
+
+
+And here we have the execution:
+
+$ mono mysql-dataset-bug.exe
+ 
+Unhandled Exception: ByteFX.Data.MySQLClient.MySQLException: A system
+exception has occurred.
+in <0x0012b> 00 ByteFX.Data.MySQLClient.MySQLParameterCollection:IndexOf
+(string)
+in <0x00058> 08 ByteFX.Data.MySQLClient.MySQLParameterCollection:IndexOf
+(string)
+in <0x0001f> 00
+ByteFX.Data.MySQLClient.MySQLParameterCollection:get_Item (string)
+in <0x00058> 08
+ByteFX.Data.MySQLClient.MySQLParameterCollection:get_Item (string)
+in <0x002aa> 00 ByteFX.Data.MySQLClient.MySQLCommand:ConvertSQLToBytes
+(string)
+in <0x00058> 08 ByteFX.Data.MySQLClient.MySQLCommand:ConvertSQLToBytes
+(string)
+in <0x0008c> 00 ByteFX.Data.MySQLClient.MySQLCommand:ExecuteNonQuery ()
+in <0x004bd> 00 System.Data.Common.DbDataAdapter:Update
+(System.Data.DataRow[],System.Data.Common.DataTableMapping)
+in <0x00076> 00 System.Data.Common.DbDataAdapter:Update
+(System.Data.DataTable,System.Data.Common.DataTableMapping)
+in <0x0006b> 08 System.Data.Common.DbDataAdapter:Update
+(System.Data.DataTable,System.Data.Common.DataTableMapping)
+in <0x000d9> 00 System.Data.Common.DbDataAdapter:Update
+(System.Data.DataSet,string)
+in <0x0006b> 08 System.Data.Common.DbDataAdapter:Update
+(System.Data.DataSet,string)
+in <0x00183> 00 .Test:Main (string[])
+
+------- Additional Comments From tsureshkumar@novell.com  2004-06-16 06:45 -------
+could not reproduce in beta3. might be fixed!!!