Query results limited to 40 rows

I am using a WCF Data Service (OData) connection to a database. When I query using this syntax: AccountCollection.Take(400), I get back 330 rows. When I use this syntax,

from a in AccountCollection
where a.UsrTMContactId > 0
select new
{
a.Id,
a.Name
}

the results are limited to 40 rows.
I am using this second form since I only need some of the columns.

Is there a way to get all rows?

Thanks

Tom

Comments

  • Update to my post: 40 rows are also returned when I remove the condition:where a.UsrTMContactId > 0
  • There seem to be some Linq Providers that limit the number of results if you don't specify how many you want. The solution is to use something like .Take(1000) or .Take(1000000) if you really can cope with a million records.
  • Excellent suggestion. That worked!
    I was limited to 2k Records, so I just needed to use Skip as well.

    from a in AccountCollection
    .Skip(40000)
    .Take(20000)
    select new
    {
    a.Id,
    a.Name,
    a.Code
    }
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!