Saturday, June 8, 2013

Entity Framework : There is already an open DataReader associated with this Command

Recently working on an application with entity framework 4.1 When I was retrieving data and updating data with same data context I was getting following error. It was working fine on another machine but on mine it was giving this error.

There is already an open DataReader associated with this Command.

After digging into the problem for some time I have found that I have not opened multiple active result set in my connection string. So what was happening when I retrieved data with entity framework there was an already opened data reader with that and after that I was updating data so we all know that an data reader is always have connected to particular connection. So it was not allowing me to update the data.
So I have added following attribute to my connection string.

“MultipleActiveResultSets=True”

Then I again test above scenario and it was working fine. It’s very easy. Hope you like it. Stay tuned for more..
Share:

0 comments:

Post a Comment

Your feedback is very important to me. Please provide your feedback via putting comments.

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews