Why do I get the error message ‘There is already an open DataReader associated with this Connection which must be closed first.’

Platform: ASP.NET| Category: ADO.NET

This is caused if you are attempting to use the same DataReader more than once in your code without closing the previous Datareader.
Or you might have a DataReader open on the same connection as the DataAdapter/Command uses. So it is not recommended to share a
connection between a DataReader and a DataAdapter/Command

  • Either close the first connection or,
  • if you must keep it open as you are executing another reader from within it, use another connection object.

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.