Quantcast
Channel: Answers by "bonskijr"
Viewing all articles
Browse latest Browse all 12

Answer by bonskijr

$
0
0
You could try using the SqlQuery method of the DBContext and explicitly use the correct type. string query = "SELECT [GroupBy1].[A1] AS [C1] FROM ( SELECT COUNT(1) AS [A1] FROM dbo.Table1 AS [Extent1] WHERE ( NOT (([Extent1].[Col1] IS NULL) OR ((LEN([Extent1].[Col1])) = 0))) AND (''0'' [Extent1].[Col1]) AND ([Extent1].[dt] = @p__linq__0) AND ((UPPER([Extent1].[CC])) = (UPPER(@p__linq__1))) AND (( CAST(CHARINDEX(LOWER(@p__linq__2), LOWER([Extent1].[ES])) AS int)) = 1) ) AS [GroupBy1]"; var param1 = new SqlParameter("@p__linq__0", System.Data.SqlDbType.Date); var param2 = new SqlParameter("@p__linq__1", System.Data.SqlDbType.Varchar, 100); var param3 = new SqlParameter("@p__linq__2", System.Data.SqlDbType.Varchar, 100); param1.Value = new DateTime(2013, 09, 30); param2.Value = "no"; param3.Value = "S1"; var res = ctx.YourEntity.SqlQuery(query, param1, param2, param3).ToList(); Sucks to not able to specify in the model itself as linq looks to ignore those, at least with the datetime. HTH

Viewing all articles
Browse latest Browse all 12

Latest Images

Trending Articles



Latest Images