Cleaning up after calls to SMO Server and Database

廉价感情. 提交于 2019-12-04 08:36:25

The MSDN article Disconnecting from an Instance of SQL Server might offer some help. It states that:

When the Connect method is called, the connection is not automatically released. The Disconnect method must be called explicitly to release the connection to the connection pool. Also, you can request a non-pooled connection. You do this by setting the NonPooledConnection property of the ConnectionContext property that references the ServerConnection object

After reading everything i managed to properly disconnect by setting

server.ConnectionContext.NonPooledConnection = true;

and then after i get my database i can call

server.ConnectionContext.Disconnect();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!