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

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 26 Aug 2003 10:08:19 -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 sergio-blanco@iespana.es.

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

--- shadow/47915	2003-08-26 10:08:19.000000000 -0400
+++ shadow/47915.tmp.18453	2003-08-26 10:08:19.000000000 -0400
@@ -0,0 +1,95 @@
+Bug#: 47915
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System.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[])