I have IEnumerable that is result of database query that has a large dataset, as much as 10000 records. I need the count to display on the webpage for pagination. How can I do it, using .Count() will result in exceptions like 1The underlying provider failed on Open` or takes way too long.
Is there a way I can query database to get the count for results by linq-sql?
It may be how you are using LINQ. if you call the query like this:
That would effectively only call a query to return a count from the database. If you did something like this:
That would call and retrieve the records from the database then try to count them.