I was playing with something like an SQL transaction version of a CAS operation, which returned a DateTime. I was then comparing the returned DateTime to the value passed in, if they matched, the update was successful.
But the value returned was NOT matching the value I put in, even if the update did actually happen... the cause:
http://seesharper.wordpress.com/2008/07/08/sql-server-datetime-vs-net-datetime-battle-of-accuracy/
From MSDN on the SQL DateTime type: "Accuracy – Rounded to increments of .000, .003, or .007 seconds"
What I was seeing was the millisecond value back very slightly different from the original.
I also noticed the 'Kind' property was different - from 'UTC' to 'Unspecified'... does this also affect the direct comparison of these? I suppose it does... I must check that.
In the mean time, I changed my transaction to return a boolean, indicating whether the update happened, instead of a DateTime. Problem solved
Monday, October 5, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment