[Mono-bugs] [Bug 76880][Nor] New - When SqlParameter is assigned
with a string date value, fails to execute the command
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Dec 2 13:13:31 EST 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 haop at immediacy.co.uk.
http://bugzilla.ximian.com/show_bug.cgi?id=76880
--- shadow/76880 2005-12-02 13:13:31.000000000 -0500
+++ shadow/76880.tmp.14079 2005-12-02 13:13:31.000000000 -0500
@@ -0,0 +1,58 @@
+Bug#: 76880
+Product: Mono: Runtime
+Version: 1.1
+OS: other
+OS Details: RedHat Enterprise 4 AS x386
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: haop at immediacy.co.uk
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: When SqlParameter is assigned with a string date value, fails to execute the command
+
+Description of Problem:
+When SqlParameter is assigned with a string date value, fails to execute
+the command.
+When this date value is converted to System.DateTime (using
+Convert.ToDateTime), it works as expected.
+
+Steps to reproduce the problem:
+Sample Code:
+
+ string cs = "connectionstring";
+ string date = "2000-02-03";
+ SqlConnection conn = new SqlConnection(cs);
+ conn.Open();
+ string sql = "SELECT * from some_table where last_update > @DATEFROM";
+ SqlCommand command = new SqlCommand(sql);
+ command.Parameters.Add("@DATEFROM", SqlDbType.DateTime).Value = date;
+ command.Connection = conn;
+
+ try
+ {
+ SqlDataReader dataSource = command.ExecuteReader();
+ int count = dataSource.FieldCount;
+ Controls.Add(new LiteralControl(Convert.ToString(count)));
+ }
+ finally
+ {
+ conn.Close();
+ }
+
+Actual Results:
+The command should be executed correctly.
+
+Expected Results:
+The "InvalidCastException" is thrown
+
+How often does this happen?
+Always
+
+Additional Information:
+Use mono 1.1.10
More information about the mono-bugs
mailing list