Errors with DataReader

If you see this error:
There is already an open DataReader associated with this Command which must be closed first

It means you did not close the DataReader after getting a result.

However we cannot always close the DataReader before a new instance is created. as in some web application that processes several requests in parallel.

The solution is to add: MultipleActiveResultSets=true
To the connection string.

Post a Comment

Previous Post Next Post