Should I always use connection.close
Should I always close my db connection or is it closed automatically?
What happens if I don't close it?
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.
How does the auto开发者_JS百科matic closing differ between SQL Server 2008 and 2012?
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.
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.
No. Since an error is going to bring your script to an end fairly quickly I wouldn't worry about trying to handle that.
No. ASP and ADODB are not really bothered about the version of SQL Server they are being asked to connected to.
精彩评论