on 2013 Aug 13 6:38 PM
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
Request clarification before answering.
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 );
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
61 | |
8 | |
7 | |
6 | |
6 | |
4 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.