The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

I'm coming over from the MSSQL world and have gotten used to things like Skip to help with paging.

From what I can gather Skip isn't supported with the iSqlAnywhere provider so the only way I can think of off the top of my head are to use my filtered IQueryable to bring back primary keys and perform a skip take on them in memory and then do a contains to bring back the actual data I need.

To me this seems kind of hacky and I would definitely appreciate any other thoughts on the matter.

Writing SQL statements directly is not an option.

Here is an example of what I'd be doing.

IQueryable<foo> bar =  someAlreadyFilteredQueryable;
var barIds = bar.Select(b=>b.Id).ToList();
var finalIds = barIds.Skip(pageNum * pageSize).Take(pageSize);
var result =  someAlreadyFilteredQueryable.Where(s=> finalIds.Contains(s.Id)).ToList();

Like I said it seems hacky considering I can just do someAlreadyFilteredQueryable.Skip(pageNum * pageSize).Take(pageSize).ToList() with MSSQL.

Edit: It appears the query generated behind the scenes uses the ALL keyword that isn't supported in the version of sybase I'm hitting.

TLDR - You need to be on V12 to use Skip

asked 13 Aug '13, 17:38

elindalyne's gravatar image

elindalyne
101339
accept rate: 0%

edited 15 Aug '13, 10:22


Skip is supported. I use it in my code all the time.

Edit:

For example, here's some code from my program that performs a paged search of one of the tables in our database:

noPages = (int) ( noMatchingEntries / pageSize );
if ( noMatchingEntries % pageSize != 0 )
    noPages++;

if ( pageNo > 0 ) {
    query = query.Skip( pageNo * pageSize );
}

query = query.Take( pageSize );
permanent link

answered 14 Aug '13, 09:26

TonyV's gravatar image

TonyV
1.2k333967
accept rate: 75%

edited 15 Aug '13, 08:20

Can you give me an example? What version are you running?

Every time I attempt to do so I get a syntax error - 'Syntax error near 'ALL' on line 6'

(14 Aug '13, 10:23) elindalyne
Replies hidden

What SA version are you using?

(14 Aug '13, 10:33) Reimer Pods

It appears this particular DB is on 11.0.1.2506

(14 Aug '13, 10:34) elindalyne

We're using SA 12.0.1.3895. We're also using the same version of the SA ADO.NET / Entity Framework driver. See the edits to my answer for an example.

(15 Aug '13, 08:18) TonyV
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×64

question asked: 13 Aug '13, 17:38

question was seen: 1,785 times

last updated: 15 Aug '13, 10:22