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 8477033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:20:43+00:00 2026-06-10T18:20:43+00:00

I have a entity object in c#. It queries a database table called FBApi.

  • 0

I have a entity object in c#. It queries a database table called FBApi. The table stores an integer year and integer month. I have function that needs to return all records greater than the passed in parameters.

public query(int myYear, int myMonth){
   var context = new MCSSUtility.Entities();
   return context.FBApis.Where(p => p.month == month && p.year == year);
}

I was thinking of converting the integers to a DateTime object, but i am not sure how to dynamically convert the where clause to Datetime variable?

public query(int myYear, int myMonth){
   DateTime my = new DateTime(myYear,myMonth,1);
   var context = new MCSSUtility.Entities();
   return context.FBApis.Where(p => new DateTime(p.year,p.month,1) >= my);
}
  • 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-10T18:20:45+00:00Added an answer on June 10, 2026 at 6:20 pm

    Please try this one:

                public query(int myYear, int myMonth){
                   DateTime my = new DateTime(myYear,myMonth,1);
                   var context = new MCSSUtility.Entities();
                   return context.FBApis.Where(p => EntityFunctions.CreateDateTime(p.year, p.month, 1, 0, 0, 0)  >= my);
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an ASP.NET web service that returning a custom entity object (Staff): [WebMethod]
I have an XML document that I generate from an Entity Framework object. The
When adding a new Entity Framework object to a database, how could one have
I have 2 very simple queries in entity framework that group by a column
I have an entity object Country with country name and country code. It is
Suppose I have an entity object defined as public partial class Article { public
it's possible to have one entity object (class, e.g. User) for more entity models
My current setup : I have an entity object with some properties, among them
I have an entity Tag and an entity Note . A note object can
I have a JPA object which has a many-to-many relationship like this: @Entity public

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.