[Mono-bugs] [Bug 80961][Maj] New - DateTime missing milliseconds as output Parameter

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Feb 26 14:02:40 EST 2007


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 prensing at cimetrics.com.

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

--- shadow/80961	2007-02-26 14:02:40.000000000 -0500
+++ shadow/80961.tmp.10620	2007-02-26 14:02:40.000000000 -0500
@@ -0,0 +1,64 @@
+Bug#: 80961
+Product: Mono: Class Libraries
+Version: 1.2
+OS: 
+OS Details: Fedora 5 with Mono 1.2.3.1
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Sys.Data.SqlClient
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: prensing at cimetrics.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: DateTime missing milliseconds as output Parameter
+
+Description of Problem:
+I am trying to use the SqlDataAdapter.Update against MS SqlServer 2003.
+This is to update a DataTable. The table includes DateTime column (nullable).
+
+The update SQL command looks like ({snip} is obviously not real):
+
+UPDATE [EQUIPMENT] SET [ORIGINALID] = @p1 {snip} where {snip} AND ((@p22 =
+1 AND [CREATION] IS NULL) OR ([CREATION] = @p23)) {snip}
+
+So, to match the exact row to update, the WHERE clause includes a test for
+every field including CREATION.
+
+The problem is that the actual database value for CREATION is 2007-01-31
+16:27:46.247 but what gets sent over the wire is "Jan 31 2007 04:27:46 PM".
+The problem is not the format but the missing millisecond part. I tested
+with isql an the row is found if you just add the ".247".
+
+I believe the problem is in Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs,
+function FormatParameter() (also in Tds50.cs?). The code hand formats the
+DateTime as:
+
+value = String.Format(System.Globalization.CultureInfo.InvariantCulture, 
+                                "'{0:MMM dd yyyy hh:mm:ss tt}'", d );
+
+ignoring the milliseconds.
+
+Steps to reproduce the problem:
+1. Create table with DateTime. Set DB value with time, including non-zero
+milliseconds (may need to be loaded from Windows or external command).
+2. Use DataSet and DataAdapter to load the table.
+3. Modify a value in a row.
+4. Use DataAdapter and default SQL commands from SqlCommandBuilder to
+update the table.
+
+Actual Results:
+Row is not updated because DateTime field does not match exactly. Update
+command throws ConcurrencyViolation because no rows were updated.
+
+Expected Results:
+Row should match and update.
+
+How often does this happen? 
+Always.
+
+Additional Information:
+Works fine on Windows.


More information about the mono-bugs mailing list