none
There is already an open Data Reader associated with this Connection which must be closed first RRS feed

  • Question

  •  

    Hi .


    We have an Desktop application Built with Dot Net  Remoting , My classes are Singleton,  When  Concurrently two  Users Accessing  the Fill Method of  Data Adapter at the same time I get the Error


    "There is already an open Data Reader associated with this Connection which must be closed first."


     

    Monday, April 7, 2008 8:59 AM

Answers

  • This error is always associated with thte fact that you are trying to use an existing connection that already has an active DataReader assocaited with it.  You mention that two users are accessing the Fill method on the DataAdapter are you locking the DataAdapter object?  Also, if you need to use 1 connection and have multiple readers active you will need to enable the Multiple Active resultsets with SqlConnection.  In order to do this add "MultipleActiveResultSets=true".  Note, that this can only be used with SQL Server 2005 and above and there are side effects of using MARS.

     

    If you really have 2 users I would just create a new DataAdapter and Connection for each user.  With Connection Pooling enabled the hit you will take is minimal.

     

     

     

    Thursday, April 10, 2008 5:22 PM