Home > Cannot Be > Query Results Cannot Be Enumerated

Query Results Cannot Be Enumerated

Contents

This is what the error is trying to tell you. I have a repository class which contains the ef data context. ERROR: The result of a query cannot be enumerated more than once1The query results cannot be enumerated more than once1'The Query Results cannot be enumerated more than once'4LINQ : The query General FAQ Ask a Question Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Ask a Question All Questions All Unanswered FAQ

if any one have a idea give me slutions.. As other member suggested, enumerating theeveryresult by calling ToList(). more hot questions question feed lang-cs about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation Boss sends a birthday message.

The Result Of A Query Cannot Be Enumerated More Than Once Store Procedure

See Trademarks or appropriate markings. HELP! Any suggestions?

Show that the square matrix A is invertible Are there still systems around with a /bin/sh binary? Try running it again and don't expand the query/debug. What is the most efficient & fastest way to speed up the installation of packages with thousands of items? The Query Results Cannot Be Enumerated More Than Once. Linq To Sql When does TNG take place in relation to DS9?

Back to Top Close .NET TOOLBOX DevCraft MOBILE APP DEVELOPMENT Telerik Platform DIGITAL CONTENT & EXPERIENCE Progress Sitefinity SOFTWARE QUALITY Test Studio Get Products Free Trials Pricing Solutions Enterprise Partners Resources The Result Of A Query Cannot Be Enumerated More Than Once Entity Framework public IEnumerable Search(int id, string searchText) { return this.entityContext.Search(id, searchText); } The function import Search calls a stored precedure to return a collection of SearchItem. Replace Your Code From foreach (var item in query) To #: foreach (var item in query.ToList()) Entity Framework query error Latest Blogs Creating A Great Personal Online Portfolio Avoiding Common Mistakes Mimsy were the Borogoves - why is "mimsy" an adjective?

IEnumerable should only be used if you are processing the data once, and might not even be processing all of it. The Result Of A Query Cannot Be Enumerated More Than Once. Iqueryable What is the most someone can lose the popular vote by but still win the electoral college? Should I report it? Kendo UI Resources Buy Try Feed for this thread 4 posts, 0 answers Bob 17 posts Member since: Aug 2013 Posted 05 Dec 2013 Link to this post I have a

The Result Of A Query Cannot Be Enumerated More Than Once Entity Framework

Join them; it only takes a minute: Sign up IEnumerable - foreach - The result of a query cannot be enumerated more than once up vote -1 down vote favorite I http://stackoverflow.com/questions/17004634/the-result-of-a-query-cannot-be-enumerated-more-than-once This may be the problem (in which case the question needs to be changed) or it could be a different problem that this wouldn't address. –Servy Aug 6 '13 at 20:58 The Result Of A Query Cannot Be Enumerated More Than Once Store Procedure How does Gandalf end up on the roof of Isengard? The Result Of A Query Cannot Be Enumerated More Than Once Mvc This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL) Top Experts Last 24hrsThis month Peter Leow 185 OriginalGriff 160 F-ES

I'm thinking that's where the error is coming from. Thanks! What's the magic to do this? How do I use .Skip() and not get that error? The Result Of A Query Cannot Be Enumerated More Than Once. Objectresult

Possible repercussions from assault between coworkers outside the office Why dd takes too long? So far so good... Because you're calling it in a loop, memIDs is being repeatedly enumerated. Can Trump undo the UN climate change agreement?

asked 2 years ago viewed 254 times active 2 years ago Upcoming Events 2016 Community Moderator Election ends Nov 22 Visit Chat Linked 44 The result of a query cannot be Objectresult To List i try to solve this error but its not fix when this error hase comes. Should I allow my child to make an alternate meal if they do not like anything served at mealtime?

Not the answer you're looking for?

Perhaps you might be missing a brace, but I did not want to assume. Although note he's not just executing the query twice, he's executing it once, plus an additional time for each matching UserGuid, which could be quite a few times. –Servy Mar 11 If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Nullable Object Must Have A Value. Oracle SQL - can I return the "before" state of a column value Wrong way on a bike lane?

more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed How often should I replace windscreen wiper blades? When does TNG take place in relation to DS9?

Which word should I use for "to drive (a car)"? Can an object *immediately* start moving at a high velocity? There are similar issues with it. Once it is a List you can use it as many times as you want.

A39.1K Updated 5-Apr-11 14:37pm v2 Comments Henry Minute 5-Apr-11 20:08pm Sounds reasonable to me! +5 Add a Solution Add your solution here B I U S small BIG code Your Email Password Forgot your password? var search = context.Search_All("a", "b", "c", "d", "1", true) .ToList() .Select( item => new SearchResultModel { ID1 = item.ID1, ID2 = item.ID2, 1D3 = item.ID3, Name= item.Name, Name2= item.Name2}).ToList();
Then you are assigning this as a data source to GridView1, which enumerates the results again thereby causing this error.

Join them; it only takes a minute: Sign up 'The Query Results cannot be enumerated more than once' up vote 1 down vote favorite I have a sql server procedure I So change IEnumberable to List and make any other relevant changes. It's not clear how the last block of code relates to your question. –spender Mar 11 '13 at 14:22 add a comment| 3 Answers 3 active oldest votes up vote 5 On 1941 Dec 7, could Japan have destroyed the Panama Canal instead of Pearl Harbor in a surprise attack?

Can Trump undo the UN climate change agreement? What crime would be illegal to uncover in medieval Europe? I assume you're trying to take N items at a time and do something with them? Kim Togo 5-Apr-11 15:47pm Perhaps "RealEstateDataClassesDataContext" is a forward-only database lookup ? 1 solution Rate this: Please Sign up or sign in to vote.

On 1941 Dec 7, could Japan have destroyed the Panama Canal instead of Pearl Harbor in a surprise attack? 301RedirectModule isn't working for URL with dot file name How to delete please check that and answer me. View All Notifications Email : * Password : * Remember me Forgot password? Non-Repetitive Quine On 1941 Dec 7, could Japan have destroyed the Panama Canal instead of Pearl Harbor in a surprise attack?

Can I substitute decaf coffee for espresso Polyglot Anagrams Cops' Thread How often should I replace windscreen wiper blades? Thanks! Or rather than changing the method's return type, you can call ToList on it when you use it and use the returned List instead.