[Mono-bugs] [Bug 75044][Nor] New - InvalidCastException thrown when executing SqlCommand with SqlDateTime parameter value

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed May 25 17:55:18 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 morpheus4you at gmail.com.

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

--- shadow/75044	2005-05-25 17:55:18.000000000 -0400
+++ shadow/75044.tmp.31425	2005-05-25 17:55:18.000000000 -0400
@@ -0,0 +1,70 @@
+Bug#: 75044
+Product: Mono: Class Libraries
+Version: 1.1
+OS: Debian Woody
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Data.SqlClient
+AssignedTo: rodrigo at novell.com                            
+ReportedBy: morpheus4you at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: InvalidCastException thrown when executing SqlCommand with SqlDateTime parameter value 
+
+Steps to reproduce the problem:
+1. Create a MS SQL 2000 Database called 'monotest' using the attached
+createscript_tbluser.sql
+2. Download the attached TestSqlDateTime.cs and change the connectionstring
+3. Compile the script with MS.NET compiler into an executable
+4. Run the executable with mono.exe (i used 1.1.7 on Windows)
+5. A System.InvalidCastException will ne thrown.
+
+Actual Results:
+
+Unhandled Exception: System.Exception: Error occured while inserting user.
+---> System.InvalidCastException: Cannot cast from source type to
+destination type.
+in <0x000e6> Mono.Data.Tds.Protocol.Tds70:FormatParameter
+(Mono.Data.Tds.TdsMetaParameter parameter)
+ in (wrapper remoting-invoke-with-check)
+Mono.Data.Tds.Protocol.Tds70:FormatParameter (Mono.Data.Tds.TdsMetaParameter)
+ in <0x0015b> Mono.Data.Tds.Protocol.Tds70:BuildParameters ()
+in (wrapper remoting-invoke-with-check)
+Mono.Data.Tds.Protocol.Tds70:BuildParameters ()
+in <0x003be> Mono.Data.Tds.Protocol.Tds70:BuildProcedureCall (System.String
+procedure)
+in (wrapper remoting-invoke-with-check)
+Mono.Data.Tds.Protocol.Tds70:BuildProcedureCall (string)
+in <0x00029> Mono.Data.Tds.Protocol.Tds70:ExecProc (System.String
+commandText, Mono.Data.Tds.TdsMetaParameterCollection parameters, Int32
+timeout, Boolean wantResults)
+in <0x00233> System.Data.SqlClient.SqlCommand:Execute (CommandBehavior
+behavior, Boolean wantResults)
+in (wrapper remoting-invoke-with-check)
+System.Data.SqlClient.SqlCommand:Execute (System.Data.CommandBehavior,bool)
+in <0x0004e> System.Data.SqlClient.SqlCommand:ExecuteNonQuery ()
+in (wrapper remoting-invoke-with-check)
+System.Data.SqlClient.SqlCommand:ExecuteNonQuery ()
+in <0x00256> DefaultNamespace.TestSqlDateTime:Main (System.String[]
+args)--- End of inner exception stack trace ---
+in <0x0030c> DefaultNamespace.TestSqlDateTime:Main (System.String[] args)
+in <0x00453> MonoTest.MainClass:ExecuteQuery ()
+in <0x00063> MonoTest.MainClass:Main (System.String[] args)
+
+Expected Results:
+A new record should have been added to the tabel tblUser without an
+exception being thrown, just like on .NET 1.1.4322.
+
+How often does this happen? 
+When run on Mono (tested with Mono 1.1.7 on both Linux and Windows) the
+example code always throws an InvalidCastException.
+
+Additional Information:
+It seems there is a same sort of bug when using an SqlBoolean value as
+parameter for a SqlCommand running as Stored Procedure. I will report a
+different bug report when this bug is verified as a valid bug.


More information about the mono-bugs mailing list