I use the following code to query my database:
private const int PAGE_SIZE = 10;
public static IList<Image> GetTopImagesForUser(String connectionString, int userID, int page)
{
dbDataContext db = new dbDataContext(connectionString);
var images = (from p in db.Images
where (p.SubmitterUserIndex == userID &&
p.URL != "none" &&
p.ThumbURL != "none")
orderby p.Rep descending
select p).Skip(page * PAGE_SIZE).Take(PAGE_SIZE);
return topImages;
}
If I call this code with page 0, everything will work the way I want it - I get a beautifully ordered list, 10 results, everything is correct.
1, , 0, 1. , . , . , URL ThumbURL "none". . , , - , , , , .
, , , orderby, , .
public static IList<Image> GetAllImagesForUser(String connectionString, int userID, int page)
{
dbDataContext db = new dbDataContext(connectionString);
var images = (from p in db.Images
where (p.SubmitterUserIndex == userID &&
p.URL != "none" &&
p.ThumbURL != "none")
orderby p.SubmitTime descending
select p).Skip(page * PAGE_SIZE).Take(PAGE_SIZE);
return allImages;
}
- - ? , , , ? , .