我为什么要关闭和销毁记录? [英] Why should I close and destroy a recordset?

查看:199
本文介绍了我为什么要关闭和销毁记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读这篇文章: http://www.utteraccess.com/wiki/index的.php / Recordsets_for_Beginners 和它说,对我来说,关闭和销毁RS的这个样子是很重要的:结果
rs.close
集RS =什么
结果
如果我不这样做,一些错误可能发生。


  1. 什么样的​​虫子?

  2. 这是什么 rs.close 意味着什么?这是否意味着到数据库的连接将保持打开状态,只要 RS 未关闭?


解决方案

rs.close 清理在内部使用的资源,但是因为ASP是一个单一的过程,没有任何GC的设置RS =在清理没有的辅助工具。

据去引用你的对象,没有它你将有一个内存泄漏。不错,不是吗?

I read this article: http://www.utteraccess.com/wiki/index.php/Recordsets_for_Beginners, and it says that it's important for me to close and destroy RS's like this:
rs.close Set rs = Nothing
and if I don't, some bugs may happen.

  1. What kind of bugs?
  2. What does rs.close means? Does it mean that the connection to the database is kept open for as long as the rs isn't closed?

解决方案

rs.close cleans up the resources that are used internally, however because ASP is a single process that doesn't have any GC the Set rs = Nothing aids in the clean up.

It de-references your objects, without it you'll have a memory leak. nice isn't it?

这篇关于我为什么要关闭和销毁记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆