Using MySQLConnection in C# does not close properly

后端 未结 4 665
我在风中等你
我在风中等你 2020-12-01 18:15

Final solution:

The connection was added to the connection pool. So I closed it, but it still remained physically open. With the ConnectionString Parameter \"Pooli

4条回答
  •  醉梦人生
    2020-12-01 18:57

    Im unsure about mysqlconnection but the sql server counter part uses Connection pooling and does not close when you call close instead it puts it in the connection pool!

    Edit: Make sure you dispose the Reader, Command, and Connection object!

    Edit: Solved with the ConnectionString Parameter "Pooling=false" or the static methods MySqlConnection.ClearPool(connection) and MySqlConnection.ClearAllPools()

提交回复
热议问题