Solved

Two conditions in IQueryable

Posted on 2012-03-09
3
270 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

932 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now