Solved

viewing specific date of data?

Posted on 2012-03-10
4
217 Views
Last Modified: 2012-03-10
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));
        }
0
Comment
Question by:Whing Dela Cruz
  • 3
4 Comments
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 37704940
You could modify to:

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

/gustav
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 37704953
And I think you have a typo here:

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

/gustav
0
 

Author Closing Comment

by:Whing Dela Cruz
ID: 37705404
Thanks a lot... Perfect!
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 37706227
You are welcome!

/gustav
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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

895 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

17 Experts available now in Live!

Get 1:1 Help Now