开发者

Should I always use connection.close

  1. Should I always close my db connection or is it closed automatically?

  2. What happens if I don't close it?

  3. Is it somehow possible to close the connection in the case of asp error? I don't want to use "on error goto next" -command but stop the script if an error occurs.

  4. How does the auto开发者_JS百科matic closing differ between SQL Server 2008 and 2012?


  1. Yes you should always endeavour to close anything you open. Doing this as early as possible in code releases resources that can be re-used by other requests.

  2. Not much, the connection will be closed when the connection object is completely de-referenced, in typical ASP code (where most developers seem oblivious to the concept of a function or sub procedure) this will be when your script has completed. This could keep the connection open longer than is necessary damaging the scalability of the app.

  3. No. Since an error is going to bring your script to an end fairly quickly I wouldn't worry about trying to handle that.

  4. No. ASP and ADODB are not really bothered about the version of SQL Server they are being asked to connected to.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜