[Mono-bugs] [Bug 66087][Min] Changed - Using uniqueidentifier parameters with Tds70 and SQL 2000 doesn't work

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 12 Apr 2005 11:19:41 -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 informatique.internet@fiducial.fr.

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

--- shadow/66087	2004-10-06 06:50:38.000000000 -0400
+++ shadow/66087.tmp.19767	2005-04-12 11:19:41.000000000 -0400
@@ -65,6 +65,47 @@
 The bug description says query analyzer.
 
 I tried by creating a stored procedure to do the select. But the
 stored procedure doesnot return any values even in case of .NET.
 Mono is behaving the same as .NET.
 Please clarify with the sample code.
+
+------- Additional Comments From informatique.internet@fiducial.fr  2005-04-12 11:19 -------
+I have exactly the same problem, but i'm not using any stored procedure.
+I just call this code :
+
+SqlCommand cmdModule = new 
+SqlCommand("SELECT MODULE_ID, PRODUIT_ID FROM MODULE WHERE
+PRODUIT_ID=@PRODUIT_ID",cnxProduit);
+
+cmdModule.Parameters.Add("@PRODUIT_ID",SqlDbType.UniqueIdentifier);	
+cmdModule.Parameters["@PRODUIT_ID"].Value=new Guid(idProduit);
+
+cmdModule.Transaction = transac;
+
+dtaProduit.SelectCommand = cmdModule;
+
+dtaProduit.Fill(dsProduit,"Module");
+
+with no modification of Mono.Data.Tds.Protocol/Tds70.cs
+i get no result
+when adding this patch :
+Index: mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs
+===================================================================
+--- mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs	(revision
+42829)
++++ mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs	(working copy)
+@@ -436,7 +437,8 @@
+ 				value = String.Format ("N'{0}'", parameter.Value.ToString
+().Replace ("'", "''"));
+ 				break;
+ 			case "uniqueidentifier":
+-				value = String.Format ("0x{0}", ((Guid) parameter.Value).ToString
+("N"));
++				value = String.Format ("'{0}'", ((Guid) parameter.Value).ToString
+());
+ 				break;
+ 			case "bit":
+ 				if (parameter.Value.GetType () == typeof (bool))
+
+I think Jan Singger has right, sql server don't understand the 0x....
+format for a guid...