View Ticket
Not logged in
Ticket Hash: d0116ee2c32c45d1eff3557b8cd0dba64a9de16e
Title: cannot set connection while a datareader is active; but is just closed
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Data_Reader Resolution: Not_A_Bug
Last Modified: 2014-05-08 17:19:20
Version Found In:
User Comments:
anonymous added on 2014-04-10 13:44:37:
Hello, i try to submit this problem because have not evident solution.

I obtain this error:

"cannot set connection while a datareader is active"

in a code that have just closed datareader...

It happen only in SQlite so i would ask your help please.

Here a cose used.

Public Dati As System.Data.Common.DbDataReader 
Public objCmd As System.Data.Common.DbCommand 


Call CloseDati()

objCmd.Connection = Connetti 'Here start the error
objCmd.CommandText = strSQLvar 
Dati = objCmd.ExecuteReader() 
Catch ex As Exception
       MsgBox("error message " & vbCrLf & vbCrLf & ex.Message, MsgBoxStyle.Exclamation)

End Try

I use provider factory with SQlite dll v with option "Flags=StickyHasRows"

mistachkin added on 2014-04-10 19:29:02: (text/x-fossil-plain)
I've added a test case for this issue, here:


However, I'm unable to reproduce the issue being described.  Is it possible
that the data reader associated with the command is *NOT* being closed prior
to attempting to reset the connection?

mistachkin added on 2014-05-08 17:19:20: (text/x-fossil-plain)
This ended up being an issue with the code using System.Data.SQLite.  In this
case, it was a data reader leaked from the ExecuteReader method.