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 |
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 ); 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
|