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

  • Home
  • SEARCH
  • 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 8253615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:56:16+00:00 2026-06-08T00:56:16+00:00

I have some issues with date comparisons I’m working on that you will see

  • 0

I have some issues with date comparisons I’m working on that you will see in the code (how to do DateTime.Now.AddMonth(2) without a compile error would be nice to know), but what I’m really interested in is why when I iterate through my foreach, and attempt to print the employer organization name, I get a null pointer exception. Following debug confirms that the employer entity is present, but null. I expected that join would have given me access to this…

 csoDBConDataContext db = new csoDBConDataContext();
 db.ObjectTrackingEnabled = false;//see above comment

 var results = (from job in db.jobs
                join employer in db.employers on job.employer_id equals 
                     employer.employer_id
                where job.cache_major.Contains("business") && 
                      job.count_major <= 30 && job.del != true &&
                      job.joblocation != null &&
                      DateTime.Now.AddMonth(2).CompareTo(((DateTime)job.postdate)) >= 0 &&
                      DateTime.Now.CompareTo(((DateTime)job.expiredate)) >= 0 &&
                      job.status_id != 406
                 orderby Convert.ToDateTime(job.postdate).DayOfYear
                 select job
                ).Take(20);

 foreach (var j in results) {
          output += j.jobtitle + j.joblocation + j.expiredate + j.postdate +
          j.employer.organizationname + Environment.NewLine + Environment.NewLine;
         }
  • 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-06-08T00:56:17+00:00Added an answer on June 8, 2026 at 12:56 am

    By selecting job, you are effectively telling Entity Framework that you are only interested in the scalar values on the Job type.

    You can eager load employer properties like this:

    var results = (from job in db.jobs.Include("employer")
                  // ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some issues with a PHP file that is not working properly. The
I ran git pull origin and now I have some issues with merge my
I have some real issues with display and saving a date. Its setup in
Our build person was having issues compiling some source code that is checked into
We have some configuration issues that we would like to solve by putting in
I have this query, that's been giving me some issues, it looks like this:
I have some issues in setting the classpath for the a project for which
I have some issues with my EJB 3 timer where it is launched more
I'm have some issues adding a class to 2 navigation links on a theme.
I seems to have some issues in order to compile gproc from uwiger. I

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.