当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - 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

网友答案:

Make sure that in your *.edmx, under the ComplexType section, the Precision property is filled correctly

分享给朋友:
您可能感兴趣的文章:
随机阅读: