|Title:||cannot set connection while a datareader is active; but is just closed|
|Last Modified:||2014-05-08 17:19:20|
|Version Found In:||18.104.22.168|
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 Try 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 22.214.171.124 with option "Flags=StickyHasRows"
mistachkin added on 2014-04-10 19:29:02:
I've added a test case for this issue, here: [/artifact?ci=trunk&filename=Tests/tkt-d0116ee2c3.eagle] 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:
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.