Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 21st, 2005, 08:35 AM
kila kila is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 90 kila User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 33 m 59 sec
Reputation Power: 5
Where to place Recordset.close

I woke up to find my site crashed today, Microsoftr Access 'Out of System Resources' error.

Seems like the most likely cause is an unclosed recordset.

I have gone over my code and it seems like every rs.open has a corresponding:

rs.close
set rs = Nothing

My question is, does the placement in my ASP file make a difference to anything? I have a rs.open, then several IF's that use the data, then the rs.close. Could having my rs.close way down at the bottom be causing it to not work? The question in a simpler form: If a recordset is closed, can code after the close still access the recordset data?


Another question, do I need to put a 'strSQL.close' after the following statement :

strSQL_NEW="UPDATE [qOrders] Set [status]='Completed', [TrackingNumber]='"&PP_Txn_ID&"', [carrier]='Digital' WHERE [OrderID]="&PP_Item_Name
'Call up the customer order info:
cnDZ.Execute(strSQL_NEW)


Thanks..

Reply With Quote
  #2  
Old April 21st, 2005, 08:44 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 102274 Folding Title: Super Ultimate Folder - Level 1Folding Points: 102274 Folding Title: Super Ultimate Folder - Level 1Folding Points: 102274 Folding Title: Super Ultimate Folder - Level 1Folding Points: 102274 Folding Title: Super Ultimate Folder - Level 1Folding Points: 102274 Folding Title: Super Ultimate Folder - Level 1Folding Points: 102274 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
Hi,

you don't and can't as far as I know do a strSQL.close, its only a string and should not cause errors.

A good way to close the rs is right after you have finished using the recordset.

As long as you have a rs.close on each page, you should be good.

Hope this helps
__________________
Look! Its a ShemZilla



Reply With Quote
  #3  
Old April 21st, 2005, 08:50 AM
kila kila is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 90 kila User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 33 m 59 sec
Reputation Power: 5
Thanks,

I have a rs.open, and then 3 IF clauses that use the data from that recordset. Do I need to put a rs.close after each IF statement, or simply one at the end of the file?



Quote:
Originally Posted by nofriends
Hi,

you don't and can't as far as I know do a strSQL.close, its only a string and should not cause errors.

A good way to close the rs is right after you have finished using the recordset.

As long as you have a rs.close on each page, you should be good.

Hope this helps

Reply With Quote
  #4  
Old April 24th, 2005, 10:52 AM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 22 h 33 m
Reputation Power: 181
As soon as you close a recordset, it's no longer available to your code, so if you close a rs in a loop subsequent iterations through your loop won't be able to use the rs.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Where to place Recordset.close


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT