This question is locked. New answers and comments are not allowed.
Hi,
I've a curious problem with a linq query that accesses a datetime field and I believe this is a bug.
My table structure is as follows:
Linq query:
This generates the following SQL statement for the VistaDB backend:
So results returned from this statement are incorrect.
For example if the table contains a row ('1', '2011-01-03 00:02:08'), I expect '2011-01-03 00:00' to be returned. But I get '2011-01-03 21:35:15 ' and this is not correct.
How can I fix this ?
Thank you
Herbert
I've a curious problem with a linq query that accesses a datetime field and I believe this is a bug.
My table structure is as follows:
CREATE
TABLE
Record
(
id
Int
IDENTITY(1,1)
NOT
NULL,
propTime DateTime
NOT
NULL
...
)
Linq query:
var test = Database.AllRecords
.Select(x =>
new
{
date = x.PropTime.Date
}).ToList();
This generates the following SQL statement for the VistaDB backend:
SELECT
DATEADD(
dd,
DATEDIFF(dd, GETDATE(), a.[PropTime]),
GETDATE()
) EXPR1
FROM
[Record] a
So results returned from this statement are incorrect.
For example if the table contains a row ('1', '2011-01-03 00:02:08'), I expect '2011-01-03 00:00' to be returned. But I get '2011-01-03 21:35:15 ' and this is not correct.
How can I fix this ?
Thank you
Herbert