Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 25th, 2003, 02:55 AM
Registered User
 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Closing connections when redirecting

How important is it to close an ADODB connection?

I ask because I am producing a page that collects form data, retrieves a record set, makes various comparisons to data within that set, then, depending on whether there are clashes (particularly dates), enter the new or edited data into the database.

If the date info clashes I intend to response.redirect back to the form page with ?string detailing error or problem. There are three IF statements checking date integrity (actually it's an IF...ELSEIF....ELSEIF...ELSE UPDATE DATA) each of which will redirect.

Is it vital that I close the connection and the record set before I redirect?

Hope this is clear. Thanks

 
Old July 25th, 2003, 03:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Just put the code to close the recordset and connection in a sub and call it before any redirect or at the end of all server side code.

This will ensure that the connection and rs are closed regardless.

I'm not sure of HOW important it is in an ASP environment but not closing objects is not something I would practise in any situation, and there is no reason not to.

Rod


======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 
Old July 25th, 2003, 03:25 AM
Authorized User
 
Join Date: Jul 2003
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You are wasting web server's resousces. You definely must close it. Consider the fact that each connection reserves a certain amount of memory from your server..What happens if 100 users open a connection;; I leave the answer to you..:)

Cheers
Kostas Lagos

 
Old July 30th, 2003, 08:33 AM
Registered User
 
Join Date: Jul 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I believe that the server session time out will close all connections. This is OK for a lightly used site, however, for a heavily used site you will certainly need to create a redirect function that closes all connections then redirects the user.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening & Closing Database connections pauliehaha Classic ASP Databases 4 December 18th, 2006 08:50 AM
closing connections - application pooling goingmad Classic ASP Databases 0 September 29th, 2005 08:20 AM
closing connections - application pooling goingmad SQL Server ASP 0 September 29th, 2005 07:19 AM
Closing db connections - when/how? SoC Classic ASP Basics 11 November 23rd, 2004 05:47 PM
Closing ADO connections in new page darrenw SQL Server 2000 0 September 15th, 2003 11:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.