Using MySQLConnection in C# does not close properly

后端 未结 4 677
我在风中等你
我在风中等你 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:42

    According to the mysql docs, the MySQLConnection is not closed when it goes out of scope. Therefore you must not use it inside a using.

    Quote... "If the MySqlConnection goes out of scope, it is not closed. Therefore, you must explicitly close the connection by calling MySqlConnection.Close or MySqlConnection.Dispose."

提交回复
热议问题