Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 480401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:53:20+00:00 2026-05-13T00:53:20+00:00

I am thoroughly frustrated right now. I am having an issue with LINQ-To-SQL. About

  • 0

I am thoroughly frustrated right now. I am having an issue with LINQ-To-SQL. About 80% of the time, it works great and I love it. The other 20% of the time, the query that L2S creates returns the correct data, but when actually running it from code, it doesn’t return anything. I am about to pull my hair out. I am hoping somebody can see a problem or has heard of this before. Google searching isn’t returning much of anything.

Here is the linq query…

var query = from e in DataLayerGlobals.GetInstance().db.MILLERTIMECARDs
        where e.deleted_by == -1
        && e.LNAME == lastName
        && e.FNAME == firstName
        && e.TIMECARDDATE == startDate.ToString("MM/dd/yyyy")
        group e by e.LNAME into g
        select new EmployeeHours
        {
            ContractHours = g.Sum(e => e.HRSCONTRACT),
            MillerHours = g.Sum(e => e.HRSSHOWRAIN + e.HRSOTHER),
            TravelHours = g.Sum(e => e.HRSTRAVEL)
        };

This is the generated query….

 SELECT SUM([t0].[HRSCONTRACT]) AS [ContractHours], 
        SUM([t0].[HRSSHOWRAIN] + [t0].[HRSOTHER]) AS [MillerHours], 
        SUM([t0].[HRSTRAVEL]) AS [TravelHours]
 FROM [dbo].[MILLERTIMECARD] AS [t0]
 WHERE ([t0].[deleted_by] = @p0) 
    AND ([t0].[LNAME] = @p1) 
    AND ([t0].[FNAME] = @p2) 
    AND ([t0].[TIMECARDDATE] = @p3)
 GROUP BY [t0].[LNAME]

Now when I plug in the EXACT same values that the linq query is using into the generated query, I get the correct data. When I let the code run, I get nothing.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T00:53:21+00:00Added an answer on May 13, 2026 at 12:53 am

    What type is TIMECARDDATE? Date, datetime, datetime2, smalldatetime, datetimeoffset or character?

    Any chance local date/time settings are messing up the date comparison of startDate.ToString(...)? Since you’re sending @p3 as a string, 01/02/2009 may mean Feb 1st or January 2nd, depending on the date/time setting on the server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Short I am thoroughly confused by the array of SQL Server services available,
Im new to .NET web services and am thoroughly confused with this issue. TCP
I have decided to use SubSonic (v3.0) for the first time and thoroughly enjoy
I am thoroughly in love with TextMate . I program everything in it, including
I have another problem regarding Git. This time I thoroughly searched Google and Stack
Disclaimer: This is a follow-on question from my other question about NServiceBus which was
After having searched for an answer thoroughly on SO, I have to ask my
I am trying to automate my deployment process and am now thoroughly confused. I
I'm (thoroughly) learning SQL at the moment and came across the GROUP BY clause.
I was reading about DI thoroughly, and it seems interesting. So far, I'm totally

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.