Sunday, 15 July 2012

C# - Linq-To-SQL - Issue with queries -


I'm just frustrated right now I'm having a problem with LINQ-to-SQL, almost 80% time, it works great And I like it. The other 20% of the time, the query that L2S creates gives the correct data, but when actually running with the code, it does not return anything I'm about to pull out my hair. I hope that someone has a problem Can see or hear about it before. Google Search is not returning anything.

Here is the Linux query ...

  var query = from DataLayerGlobals.GetInstance () in E. Db.MILLERTIMECARDs where e.deleted_by == -1 & amp; Amp; E.LNAME == Last Name & amp; Amp; E.FNAME == First Name & amp; Amp; E.TIMECARDDATE == startDate.ToString ("MM / dd / yyyy") Group E by E.L.M. Select new employee in {contract horse = g. SUM (E => EHR concentrate), Millerhaur = G. s. E = & gt; E. HRSHOVEN + E. HRSOder), TravelHairs = G. SUM (E => E. H. R.str.)};  

This is a generated query ....

  SELECT SUM ([t0]. [HRScorrect]) AS [Contractors], SM ([ HRSOH]] [[T.]. [HRSOID]] S [Millarhors], SM ([T.]. [HRstrival] AS [TravelHaurs] FOr [DBO]. [Millertimcard] AS [T] WHERE ([T 0] [[Deleted0] = @ p0) and ([t]]. [Lnd] = @ p1) and ([t]] [fnd] = @ p2) and ([t]]. [ TIMECARDDATE] = @ P3) by group [T0]. [LNAME]  

Now when I plug the exact values, then that is the linq query I am getting the right data when I run the code, I do not get anything.

Any ideas?

< Div class = "post-text" itemprop = "text">

What's the time-card? Date, daytime, datetime2, smalldatetime, datetimeoffset or character?

No chance local date / time settings Are you messing up the comparison date to startDate.ToString (...) ? Since you are sending @ P3 as string , 01 / 02/2009 May 1st Feb Time settings on or January 2, date / server


No comments:

Post a Comment