Link to home
Start Free TrialLog in
Avatar of Whing Dela Cruz
Whing Dela CruzFlag for Anguilla

asked on

viewing specific date of data?

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));
        }
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

You could modify to:

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

/gustav
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Whing Dela Cruz

ASKER

Thanks a lot... Perfect!
You are welcome!

/gustav