M
mark
We are seeing a ton of this error:
There is already an open DataReader associated with this
Connection which must be closed first.
I've went through all code that uses a datareader and made
sure that we are calling the .close() method on the
readers once we're finished.
We use a custom framework for our data access, where we
inherit from a class which contains this code. In that
base class, it keeps a member variable for the connection
object, so it can be reused. Does anyone know of an issue
with doing this? That's all I can think of.
Here's our method that gets our connection object which is
used by our getreader method in our base class.
Protected Overrides Function getConnection() As
IDbConnection
If mobjConnection Is Nothing Then
mobjConnection = New SqlConnection
(ConnectionString)
mobjConnection.Open()
Else
If mobjConnection.State <>
ConnectionState.Open Then
Try
mobjConnection.Open()
Catch ex As Exception
End Try
End If
End If
Return mobjConnection
End Function
There is already an open DataReader associated with this
Connection which must be closed first.
I've went through all code that uses a datareader and made
sure that we are calling the .close() method on the
readers once we're finished.
We use a custom framework for our data access, where we
inherit from a class which contains this code. In that
base class, it keeps a member variable for the connection
object, so it can be reused. Does anyone know of an issue
with doing this? That's all I can think of.
Here's our method that gets our connection object which is
used by our getreader method in our base class.
Protected Overrides Function getConnection() As
IDbConnection
If mobjConnection Is Nothing Then
mobjConnection = New SqlConnection
(ConnectionString)
mobjConnection.Open()
Else
If mobjConnection.State <>
ConnectionState.Open Then
Try
mobjConnection.Open()
Catch ex As Exception
End Try
End If
End If
Return mobjConnection
End Function