Quick question about closing recordsets and connection objects. We're in
the process of rewriting a TON of bad code. None of it is even remotely
tabbed properly, it's impossible to read half the time and it never closes
connection objects or recordsets. Unfortunately, I've been assigned the
task of closing them. I assume I'm just doing:
recordset.close
Set recordset = Nothing
conn.close
Set conn = Nothing
....whenever it's no longer needed. I guess that my question is, how do I
need to handle redirects within a page. Should I close/set to nothing
before a redirect, or by the page losing "focus", will these objects be
released anyway?
Are there any general rules of thumb that might save me some time going
through the 1,000,000+ lines of code?
Thanks! 4 1753
James wrote: Quick question about closing recordsets and connection objects. We're in the process of rewriting a TON of bad code. None of it is even remotely tabbed properly, it's impossible to read half the time and it never closes connection objects or recordsets. Unfortunately, I've been assigned the task of closing them. I assume I'm just doing:
recordset.close Set recordset = Nothing
conn.close Set conn = Nothing
...whenever it's no longer needed. I guess that my question is, how do I need to handle redirects within a page. Should I close/set to nothing before a redirect,
Yes. Any code that appears after a redirect will not be executed.
or by the page losing "focus", will these objects be released anyway?
Maybe. It's the times that they don't close automatically that cause the
memory leaks Are there any general rules of thumb that might save me some time going through the 1,000,000+ lines of code?
Close and destroy child objects (recordsets, command objects) before closing
and destroying parent objects (connections). Note: command objects can't be
closed, only destroyed.
Or, the "Things I learned in kindergarten" version:
if you open it, close it
if you create it, destroy it
Sorry, there's nothing i've said here that will save you any time.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
> Sorry, there's nothing i've said here that will save you any time.
Not necessarily true. Going through the code now and cleaning it up, while
boring and monotonous, will save time and gray hair later when trying to
find the source of a memory leak...
A
Fair enough. We've had an issue where maybe once few days, the site is
horribly slow and basically needs to be rebooted. I have the distinct
feeling that this might solve that problem, as we've been unable to track it
down anywhere else.
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:On**************@TK2MSFTNGP10.phx.gbl... Sorry, there's nothing i've said here that will save you any time. Not necessarily true. Going through the code now and cleaning it up,
while boring and monotonous, will save time and gray hair later when trying to find the source of a memory leak...
A
Aaron [SQL Server MVP] wrote: Sorry, there's nothing i've said here that will save you any time.
Not necessarily true. Going through the code now and cleaning it up, while boring and monotonous, will save time and gray hair later when trying to find the source of a memory leak...
A
:-)
I meant clean-up time. Nothing I said provided any shortcuts to make this
task easier.
Bob
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Steve Jorgensen |
last post by:
I keep having problems in which ADO disconnected recordset work under some
circumstances, but lose all their data at other times, having no rows or
fields, though the recordset object still exists....
|
by: amazo |
last post by:
Dear all,
I would like to know if it is possible to close used recordsets in the
middle of transactions (and re-use the variable it is is necessary),
i.e.
--- begin code
Dim ws As...
|
by: lakshmi |
last post by:
Hi all,
I recently rewrote a data intensive C++ program in C#.
The C++ program was traversing 3 recordsets that were all
open at the same time. I replaced those 3 recordsets with
3 .NET data...
|
by: Simon Harvey |
last post by:
Hi All,
I have a colleague that I wprk with that develops using ASP. I develop using
ASP.net.
He seems to make sites much faster than me and I am wondering if its because
of the two different...
|
by: Randy Harris |
last post by:
I was inspired by the recent discussion of returning multiple recordsets to
ADO from a stored procedure. (Amazed is probably more accurate). I asked
about how to accomplish same with Oracle and...
|
by: mrmagoo |
last post by:
I'm building a vb.net Forms project that is getting data from a SQL Server
database.
One of the main goals of the project is to be really responsive to events,
such as textbox change events. I...
|
by: rdemyan via AccessMonster.com |
last post by:
Can someone help me with creating code that will look for DAO recordsets in
modules and then check to see if the recordset is also closed in the module.
All of my recordsets are of the form rs*...
|
by: paii, Ron |
last post by:
I have a series of recordset operations, Open/Edit/Close, Open/Edit/Close. I
want to wrap in a transaction. What happens to the edits when the record set
is close before the Commit or Rollback? Do...
|
by: Wayne |
last post by:
I have had a problem for some time with several databases and figure
there must be a common underlying cause. Sometimes when I open a
database, nothing appears to happen, but an .ldb file gets...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |