I have been refactoring my code recently and pulling all of the table adapters on an older site into repositories ready to be ported accross to NHibernate. By doing this I now have static Table Adapters in the repositories. This was all fine on dev and uat but when it wen live this caused this error:

There is already an open DataReader associated with this Command which must be closed first.

This I suppose makes sense when there are many requests hitting the same table adapter at once now that it is static. To solve this problem I have added:

MultipleActiveResultSets=True

To the connection string. This does make sense but I am going to have to have a good think if having the table adapters as static properties in the repositories is a good thing - I suppose just getting in all ported to NHibernate would be a better idea!

This URL was handy!:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=123691&SiteID=1

Posted Saturday, August 2nd, 2008 at 4:56 pm
Filed Under Category: .NET
Responses are currently closed, but you can trackback from your own site.

0

Comments are closed.