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

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 16 Sep 2004 09:00: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 jsinger@eggmouse.com.

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

--- shadow/66087	2004-09-16 09:00:19.000000000 -0400
+++ shadow/66087.tmp.2447	2004-09-16 09:00:19.000000000 -0400
@@ -0,0 +1,58 @@
+Bug#: 66087
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: Sys.Data.SqlClient
+AssignedTo: rodrigo@novell.com                            
+ReportedBy: jsinger@eggmouse.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Using uniqueidentifier parameters with Tds70 and SQL 2000 doesn't work
+
+Description of Problem:
+
+If you pass a System.Guid as parameter to a stored procedure call with
+Tds70 and SQL2000, it is converted in a format that SQL2000 SP3 actually
+does not recognize correctly.
+
+Steps to reproduce the problem:
+1. Open the Query-Analyzer-Tool for SQL 2000 with an existing database
+2. Execute the following statements:
+CREATE TABLE guid_test (
+  id uniqueidentifier
+)
+
+INSERT INTO guid_test VALUES ('3b0221fa-8896-11d3-9d6d-0080ad985bd7')
+
+select * from users where id=0x3b0221fa889611d39d6d0080ad985bd7
+select * from users where id='3b0221fa-8896-11d3-9d6d-0080ad985bd7'
+
+DROP TABLE guid_test
+
+Actual Results:
+Only the second select returns a result.
+
+Expected Results:
+Both should return a result.
+
+How often does this happen? 
+Everytime.
+
+Additional Information:
+
+Problem is in line 425 of Mono.Data.Tds.Protocol/Tds70.cs:
+
+value = String.Format ("0x{0}", ((Guid) parameter.Value).ToString ("N"));
+
+The Guid is converted to a binary presentation of uniqueidentifier, which
+seems not to work in SQL 2000 SP3 (see below to reproduce). This could be
+fixed by using the string-representation:
+
+value = String.Format ("'{0}'", ((Guid) parameter.Value).ToString());