We help IT Professionals succeed at work.

viewing specific date of data?

Whing Dela Cruz
on
How to set the code viewing specific date?

        public IQueryable<SalesRecord> GetSalesRecordDatimeId(int branchid, DateTime Sdate, DateTime Edate)
        {
            return this.ObjectContext.SalesRecords.Where(so => so.BranchID == branchid && so.TheDate == Sdate);
        }
I need to view the Data from Sdate to Edate... my xaml are as follows;

        private void button2_Click(object sender,  RoutedEventArgs e)
        {
            int BrId = int.Parse(this.txtme.Text);
            DateTime Mydate = DateTime.Parse(this.datePicker1.Text);
            DateTime xdate = DateTime.Parse(this.datePicker2.Text);
            if (_Context.EntityContainer != null) _Context.EntityContainer.GetEntitySet<SalesRecord>().Clear();
            _Context.Load(_Context.GetSalesRecordDatimeIdQuery(BrId, Mydate, xdate));
        }
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
You could modify to:

 return this.ObjectContext.SalesRecords.Where(so => so.BranchID == branchid && so.TheDate >= Sdate && so.TheDate <= Edate);

/gustav
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
And I think you have a typo here:

_Context.Load(_Context.GetSalesRecordDatimeId(BrId, Mydate, xdate));

/gustav

Author

Commented:
Thanks a lot... Perfect!
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
You are welcome!

/gustav

Explore More ContentExplore courses, solutions, and other research materials related to this topic.