[Mono-bugs] [Bug 75503][Wis] New - Guid Type conversion problem when copying a datarow...

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Jul 7 11:37:50 EDT 2005


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 informatique.internet at fiducial.fr.

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

--- shadow/75503	2005-07-07 11:37:50.000000000 -0400
+++ shadow/75503.tmp.5807	2005-07-07 11:37:50.000000000 -0400
@@ -0,0 +1,143 @@
+Bug#: 75503
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Sys.Data
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: informatique.internet at fiducial.fr               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Guid Type conversion problem when copying a datarow...
+
+I've an issue when i try to copy a datarow (extracted from a database) into
+another datarow. 
+The type of the datarow is System.Guid.
+The exception is :
+Unhandled Exception: System.ArgumentException: Unknown target conversion
+typeCouldn't store <75ca881f-cfd2-4d45-a0c6-bb1f3374466a> in
+Id_Chef_Produit Column.  Expected type is Guid. --->
+System.InvalidCastException: Unknown target conversion type
+
+I've a small test case which show how to reproduce it :
+// project created on 28/06/2005 at 09:59
+using System;
+using System.Data;
+using System.Data.SqlClient;
+
+class MainClass
+{
+	static string cnx="user id=sa;password=sa;data source=10.69.100.93;initial
+catalog=Fiche_Produit";
+
+	public static void Main(string[] args)
+	{
+		Console.WriteLine("Hello World!");
+		string requete="SELECT * FROM PRODUIT";
+		SqlCommand cmd=new SqlCommand();
+		SqlDataAdapter dta=new SqlDataAdapter(cmd);
+		DataSet ds=new DataSet();
+		cmd.Connection=new SqlConnection(cnx);
+		cmd.CommandText=requete;
+		dta.Fill(ds,"produit");
+		Console.WriteLine("Select effectué");
+		Console.WriteLine(ds.DataSetName);
+		foreach (DataColumn col in ds.Tables["produit"].Columns)
+		{
+			Console.WriteLine(col.ColumnName);
+		}
+		foreach (DataRow row in ds.Tables["produit"].Rows)
+		{
+			Console.WriteLine(row["nom_produit"].ToString());
+			Console.WriteLine(row["id_chef_produit"].ToString());
+			DataTable dt=MakeTable();
+			DataRow r=dt.NewRow();
+			r["Id_Chef_Produit"] = row["Id_Chef_Produit"];
+		}
+	}
+		private static DataTable MakeTable()
+
+		{
+
+			DataTable resultsTable = new DataTable("Results");
+
+			//Ajoute les colonnes
+
+			DataColumn newColumn = new  DataColumn();
+
+			newColumn.DataType = System.Type.GetType("System.Guid");
+
+			newColumn.ColumnName = "Produit_id";
+
+			resultsTable.Columns.Add(newColumn);
+
+			//
+
+			newColumn = new  DataColumn();
+
+			newColumn.DataType = System.Type.GetType("System.String");
+
+			newColumn.ColumnName = "Nom_Produit";
+
+			resultsTable.Columns.Add(newColumn);
+
+			//
+
+			newColumn = new  DataColumn();
+
+			newColumn.DataType = System.Type.GetType("System.Guid");
+
+			newColumn.ColumnName = "Id_Chef_Produit";
+
+			resultsTable.Columns.Add(newColumn);
+
+			//
+
+			newColumn = new  DataColumn();
+
+			newColumn.DataType = System.Type.GetType("System.String");
+
+			newColumn.ColumnName = "Nom_Chef_Produit";
+
+			resultsTable.Columns.Add(newColumn);
+
+			//
+
+			newColumn = new  DataColumn();
+
+			newColumn.DataType = System.Type.GetType("System.String");
+
+			newColumn.ColumnName = "Commentaire_Reduit";
+
+			resultsTable.Columns.Add(newColumn);
+
+			//
+
+			newColumn = new  DataColumn();
+
+			newColumn.DataType = System.Type.GetType("System.String");
+
+			newColumn.ColumnName = "Commentaire";
+
+			resultsTable.Columns.Add(newColumn);
+
+			//
+
+			newColumn = new  DataColumn();
+
+			newColumn.DataType = System.Type.GetType("System.String");
+
+			newColumn.ColumnName = "HasModules";
+
+			resultsTable.Columns.Add(newColumn);
+
+			return resultsTable;
+
+		}
+}


More information about the mono-bugs mailing list