惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Check Point Blog
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
IT之家
IT之家
月光博客
月光博客
U
Unit 42
K
Kaspersky official blog
T
Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
云风的 BLOG
云风的 BLOG
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
Engineering at Meta
Engineering at Meta
Recorded Future
Recorded Future
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security @ Cisco Blogs
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
Security Archives - TechRepublic
Security Archives - TechRepublic
Webroot Blog
Webroot Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Schneier on Security
S
Secure Thoughts
The Register - Security
The Register - Security
B
Blog RSS Feed
The Last Watchdog
The Last Watchdog
P
Palo Alto Networks Blog
爱范儿
爱范儿
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
L
LINUX DO - 热门话题
C
Cisco Blogs
Spread Privacy
Spread Privacy
F
Full Disclosure
博客园 - 聂微东
T
The Blog of Author Tim Ferriss

博客园 - Heclei

WebDeploy 同步IIS6 bindingRedirect 相当奇怪的设置 - Heclei - 博客园 C# 使用WM_NCLBUTTONDOWN消息实现任意位置移动窗体 发布开源程序:数据库结构比较 VS2005 WEB F5调试自动退出调试状态 JS整理,getCookie, getElementsByClassName , 添加删除事件 (转)C# 单实例 - Heclei - 博客园 (转)VC++ 2005 用程式建立 Paradox ( *.db ) 资料库档桉 - Heclei C# 判断操作系统类型 Service Broker实现发布-订阅(Publish-Subscribe)框架(3) Service Broker实现发布-订阅(Publish-Subscribe)框架(2) Service Broker实现发布-订阅(Publish-Subscribe)框架(1) mysql ERROR 1045 JS实现局部打印和预览 perforce,P4,权限设置 Visual Studio 2005 sp1 新愁加就恨 将一个数据库的登录账户转移到另一个账户中(Trans logins from one database to another ) Find the need for WinFx, understanding for very very beginners 使用vsto制作的outlook插件,安装加载失败
.net sqlserver 关于连接池没事释放的注意项
Heclei · 2008-08-23 · via 博客园 - Heclei

CAUTION   It is recommended that you always close the Connection when you are finished using it in order for the connection to be returned to the pool. This can be done using either the Close or Dispose methods of the Connection object. Connections that are not explicitly closed might not be added or returned to the pool. For example, a connection that has gone out of scope but that has not been explicitly closed will only be returned to the connection pool if the maximum pool size has been reached and the connection is still valid.

Note   Do not call Close or Dispose on a Connection, a DataReader, or any other managed object in the Finalize method of your class. In a finalizer, only release unmanaged resources that your class owns directly. If your class does not own any unmanaged resources, do not include a Finalize method in your class definition. For more information, see Programming for Garbage Collection.

http://msdn.microsoft.com/en-us/library/aa719770.aspx

注意:在使用完成之后建议使用Close或Dispose关闭数据链接,确保链接可以返回链接池中。链接没有立即关闭可能是因为没有添加或返回到链接池中。例如:当一个链接在执行域结束后没有被关闭,那么它将在链接数达到最大值或链接无效时才返回数据库链接池中。

Note:不要在Finalize method(析构函数)中使用Close或者Dispose来释放Connection,DataReader或其他托管对象。在析构函数中,仅释放在对象中直接使用的非托管资源。如果你的对象中没有使用非托管资源,不要定义析构函数。