Ticket Hash: | fca7a34b03b4f8c7c79415b6300b84ce11858f6b | |||
Title: | In-place creation of DateTime vs as assigned variable in the same query produced different result | |||
Status: | Closed | Type: | Incident | |
Severity: | Important | Priority: | Medium | |
Subsystem: | LINQ | Resolution: | Duplicate | |
Last Modified: | 2014-05-30 00:43:43 | |||
Version Found In: | 1.0.92 | |||
User Comments: | ||||
anonymous added on 2014-05-29 22:05:34:
(text/x-fossil-plain)
I am sorry about opening a new ticket. The previous one has been closed, and I discovered something different. Below is the description of the problem: The definition of the table is: CREATE TABLE "Order" ("Id" bigint PRIMARY KEY NOT NULL , "Date" DATETIME NOT NULL , "Type" varchar(8) NOT NULL ) I ran some more tests with how the date is created. I found that how the date is created (in place or as a variable) instead of the syntax style caused the behavior difference. // query 1 - passed, returned 2 var c = db.Orders.Where(i => i.Date == new DateTime(2014, 5, 23)).Count(); // query 2 - failed, returned 0 var date = new DateTime(2014, 5, 23); var c = db.Orders.Where(i => i.Date == date).Count(); Same behavior for both styles and both DATE and DATETIME sql type. mistachkin added on 2014-05-30 00:43:43: (text/x-fossil-plain) Duplicate ticket, see [da9f18d039670357688a27968aab836199f1ac49]. Please click on "Edit" to add comments there. |