简体   繁体   中英

Not getting millisecond data when executing SProc via Entity Framework

Im having some issues getting all the data from my sql server database. Below is one of the DateTime values i have stored in my database:

2012-12-31 21:39:08.8940

Unfortunately, when i run the same SProc via entity framework, i get the following instead:

2012-12-31 21:39:08

Is there anyway to correct this so all the data is being returned?

The SProc code is as follows:

CREATE PROCEDURE [dbo].[DataRetrieval]
    @StartDateTime      DateTime2(4)        ='2012-12-31 21:59:08.2050',
    @EndDateTime        DateTime2(4)        ='2012-12-31 21:59:08.2050',
    @Pair               nchar(6)            ='EurUsd'
AS

SET NOCOUNT ON;
BEGIN

SELECT Pair,DateTime,Ask,Bid,AskVolume,BidVolume
FROM 
    dbo.ForexData
WHERE
    PAIR = @Pair
    AND ( DateTime = @StartDateTime  
               OR DateTime >= @StartDateTime )
    AND ( DateTime = @EndDateTime
           OR DateTime < @EndDateTime )
ORDER BY
    DateTime
END
GO

确保在* .edmx中的ComplexType部分下,正确填充了Precision属性。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM