[Mono-bugs] [Bug 55162][Blo] New - SqlParameter value set to null will not result in NULL in query.
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 4 Mar 2004 11:08:05 -0500 (EST)
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 frans@sd.nl.
http://bugzilla.ximian.com/show_bug.cgi?id=55162
--- shadow/55162 2004-03-04 11:08:05.000000000 -0500
+++ shadow/55162.tmp.24588 2004-03-04 11:08:05.000000000 -0500
@@ -0,0 +1,48 @@
+Bug#: 55162
+Product: Mono/Class Libraries
+Version: unspecified
+OS:
+OS Details: XP sp1
+Status: NEW
+Resolution:
+Severity:
+Priority: Blocker
+Component: Sys.Data.SqlClient
+AssignedTo: rodrigo@ximian.com
+ReportedBy: frans@sd.nl
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: SqlParameter value set to null will not result in NULL in query.
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+When assigning the value null to an SqlParameter object, on .NET 1.1 it
+will result in @parametername=NULL in the query. In mono it results in:
+@parametername=. This leads to queries which do not run.
+
+Steps to reproduce the problem:
+1. Create a parametrized query using the SqlClient. Use 2 parameters.
+2. Give the first parameter the value null (C# null).
+3. Run the query and check SqlServer profiler.
+
+Actual Results:
+exec sp_executesql N'UPDATE [dbo].[Orders] SET [EmployeeID]=@EmployeeID
+WHERE ( [dbo].[Orders].[OrderID] = @OrderID1)', N'@EmployeeID int,
+@OrderID1 int', @EmployeeID=, @OrderID1=10254
+
+Expected Results:
+exec sp_executesql N'UPDATE [dbo].[Orders] SET [EmployeeID]=@EmployeeID
+WHERE ( [dbo].[Orders].[OrderID] = @OrderID1)', N'@EmployeeID int,@OrderID1
+int', @EmployeeID = NULL, @OrderID1 = 10254
+
+How often does this happen?
+always
+
+Additional Information:
+the sql query is generated at runtime, so are the parameters, this is why
+the value null is required to signal NULL. This works in the .NET sqlserver
+client and the Oracle ODP.NET client without a problem. If this doesn't
+work on Mono, it will make porting code to Mono harder.