Only Last Five Record

Posts   
 
    
Posts: 97
Joined: 29-Apr-2009
# Posted on: 04-Jun-2009 14:38:44   

Hello,

i have want only last five record by date from table. i want to fetch last five applied job.

so i have done work like below :



from my class :
 public JobapplicationCollection GetLastFiveAppliedJobs(int CandidateID)
        {
            JobapplicationCollection AppliedJob = new JobapplicationCollection();
            IPredicate JobFilter = (JobapplicationFields.CandidateId == CandidateID);
            AppliedJob.GetMulti(JobFilter, 0, new SortExpression(JobapplicationFields.DateApplied | SortOperator.Ascending));
            return AppliedJob;
            
        }


in my c# code:

JobapplicationCollection lastJobs = new JobapplicationCollection();
                    lastJobs = LastFive.GetLastFiveAppliedJobs(CandidateID);
                    GridView1.DataSource = lastJobs;
                    GridView1.DataBind();

so how can i do this for only last five record. this code will return all the rows.but i need only five record. i am using self servicing and my database in MYSQL

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 04-Jun-2009 22:17:53   

Set the parameter that controls the number of rows to return to 5 - it should be the value that is currently set to 0 in your GetMulti call.

Matt

Posts: 97
Joined: 29-Apr-2009
# Posted on: 05-Jun-2009 05:23:57   

MTrinder wrote:

Set the parameter that controls the number of rows to return to 5 - it should be the value that is currently set to 0 in your GetMulti call.

Matt

Thanks MTrinder, works great but i need only last five record. it gives first five records

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 05-Jun-2009 08:39:58   

You should be sorting Descendlingly instead of Ascendingly.

Posts: 97
Joined: 29-Apr-2009
# Posted on: 05-Jun-2009 09:07:42   

Walaa wrote:

You should be sorting Descendlingly instead of Ascendingly.

hi walaa,

Thanks for ur reply. i had done before Descending , on that time i was wrong to see my output, but it was working.

Thanks for reply.