How to skip N Records from document Query

Pritam Gupta asked on September 13, 2017 12:27


I want to skip N records from document query below is code


string whereCondition = "(convert(varchar,StartDate,120) between convert(varchar,'"+todayDate+"',120) and convert(varchar,'"+endOfTheDay+"',120)) OR (convert(varchar,EndDate,120) between convert(varchar,'"+todayDate+"',120) and convert(varchar,'"+endOfTheDay+"',120))";

            DocumentQuery dqLiveVideo = getQuery(page, pagesize)
                .Where(new WhereCondition(whereCondition))

            DataSet dsLiveVideo = dqLiveVideo.Result;

when i using skip method than i am getting error. is there any way to use skip method to skip N records than please help to resolve this issue.


Recent Answers

Trevor Fayas answered on September 13, 2017 16:49

What is the error you're getting?

0 votesVote for this answer Mark as a Correct answer

Pritam Gupta answered on September 14, 2017 06:07

Hello Trevor,

Actually when i adding skip method in my query than intelligence show me red squiggly line.

I am developing the custom API so,can you please correct if i implementing in wrong way


0 votesVote for this answer Mark as a Correct answer

Anton Grekhovodov answered on September 14, 2017 06:59 (last edited on September 14, 2017 07:21)

Hi Pritam,
Your syntax is wrong, just use .Skip(skipRecord) without <int>. Also, I think you have a mistake in your where condition, because you convert data property to string and then tries to compare strings with between operator, but it may return you a wrong result. Just do not use convert there. And try to avoid string where conditions, because it's too easy to make mistake. Use WhereCondition class to build your where condition, example :

    new WhereCondition()
        .WhereGreaterOrEquals("StartDate", todayDate)
        .WhereLessOrEquals("StartDate", endOfTheDay)
        .Or(new WhereCondition()
            .WhereGreaterOrEquals("EndDate", todayDate)
            .WhereLessOrEquals("EndDate", endOfTheDay)
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.