简体   繁体   中英

using datediff in entityframework entity-sql

I want to do something like this using EntityFramework entity-sql query. I am using .Net3.5

StringBuilder query = new StringBuilder(@"
                Select VALUE o
                From ordercontainer.report as o
                WHERE o.xId = @xId
                ");

query.Append("  && datediff(hh,getdate(),o.StatusChangeTimeStamp) >= @DurationInHours");

Use this method in .NET 3.5

System.Data.Linq.SqlClient.SqlMethods.DateDiffHour(startDate, endDate);

See msdn site

This class contains several more Methods that can be used in .NET3.5

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