Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 where to close the db-connection?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 08 January 2005 :  06:23:03  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
I've put alittle something together so that I can change a value in the database. But where do I put the:
rs.close
set rs = nothing
I've tried almost every line and as soon as I have the code there I get:

Microsoft VBScript runtime error '800a01a8'

Object required

/forum/changepass2.asp, line 65

Here's the file in txt-format:
http://www.gotlandrace.com/temp/changepass2.txt

I hope someone can help me with this, or with some other way to close this connection.
This is something I'll be doing on rare occasions so maybe it's not that much of a deal if I leave it open? ;)

/Tribaliztic
- www.gotlandrace.se -

The Impact
Junior Member

Australia
398 Posts

Posted - 08 January 2005 :  06:41:45  Show Profile
You are closing the variable 'rs' and then setting it to nothing. But your connnection to the database is set in the 'rsKey' variable so you should be closing 'rsKey' instead. Basically change the code which shuts down the connection to
rsKey.close
set rsKey = nothing
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 08 January 2005 :  10:56:04  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
ah.. *doh*
That's what happen when you take existing code and changing it.
Thanks alot! Will try that tomorrow!

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 10 January 2005 :  02:49:36  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
Well, I changed the wordings, but I still don't know where in the code to put the closing. Any hint? =)
Exactly what happen if I don't have any closing? Will there be an open connection for the next 3000 years? ;)

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 10 January 2005 :  06:29:31  Show Profile
I have just been reviewing the code you posted. Since you are updating the database you are not expecting to return any results from it except for whether it was successful or not. So you do not need to set it to a variable.
set rsKey = my_Conn.Execute (strSql)
All you need to do is remove the code in red and to answer your question... if you don't close a recordset IIS will close it for you. In saying that you should really make an effort to close all connections to the database as soon as you have finished dealing with them. Otherwise they will remain in the servers memory affecting performance on high traffic sites and your relying on a computer to clean-up after you - a bit unreliable sometimes

http://www.4guysfromrolla.com/webtech/060999-2.shtml
That article from 4Guys explains a bit about closing database connections.
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 10 January 2005 :  08:35:49  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
ahaaa... that's neat ;)
Thanks alot for the info!
We don't have that much traffic yet but we hope to have soon..

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.85 seconds. Powered By: Snitz Forums 2000 Version 3.4.07