Solved

Two conditions in IQueryable

Posted on 2012-03-09
3
278 Views
Last Modified: 2012-03-10
How to correct this two conditions?
        public IQueryable<SalesRecord> GetSalesRecordsBranchId(int branchid, string sDate)
        {
            return this.ObjectContext.SalesRecords.Where(so => so.BranchID == branchid);
        }
I want to insert sDate something like this... Where so.TheDate == sDate

Please help I don't know how to combine this two conditions...
0
Comment
Question by:Whing Dela Cruz
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
gopaltayde earned 500 total points
ID: 37704345
return this.ObjectContext.SalesRecords.Where(so => so.BranchID == branchid && so.TheDate == sDate );
0
 

Author Comment

by:Whing Dela Cruz
ID: 37704370
Hi! Thanks a lot.. I've got it.. can I ask 1 more question?
What about if I put another conditions specifying  the range. example I want to view only the date between February 02, 2012 and March 01, 2012

        public IQueryable<SalesRecord> GetSalesRecordsBranchId(int branchid, string sDate, string xDate)
        {
            return this.ObjectContext.SalesRecords.Where(so => so.BranchID == branchid);
        }
 I want to set sDate and xDate as the range.. Thanks in advance..
0
 

Author Closing Comment

by:Whing Dela Cruz
ID: 37704851
Thank you so much..
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question