Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Resource Use

Reply
Thread Tools

Resource Use

 
 
MDW
Guest
Posts: n/a
 
      07-26-2003
Theoretical question.

If I create an recordset using the ubiquitous

Set objRS = objConn.Execute(strSQL)

I'm told that at the end of my code, I should set objRS
back to nothing to release the resources it uses. That's
all fine and good. My question is, if I create several
different recordsets throughout the course of the ASP
page, and (because I'm lazy) I want to re-use the name
objRS....should I set it to nothing before I re-create it
using a SQL statement? In other words, is there any
appreciable performance/resource difference between these
two scenarios?

' SCENARIO 1
Set objRS = objConn.Execute(strSQL)

....

Set objRS = objConn.Execute(strSQL2)
....

Set objRS = objConn.Execute(strSQL3)
....

Set objRS = objConn.Execute(strSQL4)

....

Set objRS = Nothing

' SCENARIO 2
Set objRS = objConn.Execute(strSQL)

....

Set objRS = Nothing
Set objRS = objConn.Execute(strSQL2)
....

Set objRS = Nothing
Set objRS = objConn.Execute(strSQL3)
....

Set objRS = Nothing
Set objRS = objConn.Execute(strSQL4)

....

Set objRS = Nothing

 
Reply With Quote
 
 
 
 
Bob Barrows
Guest
Posts: n/a
 
      07-26-2003
There's nothing lazy about re-using a variable.

You only need to destroy it once at the end. It wouldn't be a bad idea to
close the recordset before opening it on another SQL statement.

Bob Barrows
PS. You should always close the recordset before setting it to nothing.
Ditto for the connection.

MDW wrote:
> Theoretical question.
>
> If I create an recordset using the ubiquitous
>
> Set objRS = objConn.Execute(strSQL)
>
> I'm told that at the end of my code, I should set objRS
> back to nothing to release the resources it uses. That's
> all fine and good. My question is, if I create several
> different recordsets throughout the course of the ASP
> page, and (because I'm lazy) I want to re-use the name
> objRS....should I set it to nothing before I re-create it
> using a SQL statement? In other words, is there any
> appreciable performance/resource difference between these
> two scenarios?
>
> ' SCENARIO 1
> Set objRS = objConn.Execute(strSQL)
>
> ...
>
> Set objRS = objConn.Execute(strSQL2)
> ...
>
> Set objRS = objConn.Execute(strSQL3)
> ...
>
> Set objRS = objConn.Execute(strSQL4)
>
> ...
>
> Set objRS = Nothing
>
> ' SCENARIO 2
> Set objRS = objConn.Execute(strSQL)
>
> ...
>
> Set objRS = Nothing
> Set objRS = objConn.Execute(strSQL2)
> ...
>
> Set objRS = Nothing
> Set objRS = objConn.Execute(strSQL3)
> ...
>
> Set objRS = Nothing
> Set objRS = objConn.Execute(strSQL4)
>
> ...
>
> Set objRS = Nothing




 
Reply With Quote
 
 
 
 
MDW
Guest
Posts: n/a
 
      07-28-2003
Thx for the info.


>-----Original Message-----
>There's nothing lazy about re-using a variable.
>
>You only need to destroy it once at the end. It wouldn't

be a bad idea to
>close the recordset before opening it on another SQL

statement.
>
>Bob Barrows
>PS. You should always close the recordset before setting

it to nothing.
>Ditto for the connection.
>
>MDW wrote:
>> Theoretical question.
>>
>> If I create an recordset using the ubiquitous
>>
>> Set objRS = objConn.Execute(strSQL)
>>
>> I'm told that at the end of my code, I should set objRS
>> back to nothing to release the resources it uses. That's
>> all fine and good. My question is, if I create several
>> different recordsets throughout the course of the ASP
>> page, and (because I'm lazy) I want to re-use the name
>> objRS....should I set it to nothing before I re-create

it
>> using a SQL statement? In other words, is there any
>> appreciable performance/resource difference between

these
>> two scenarios?
>>
>> ' SCENARIO 1
>> Set objRS = objConn.Execute(strSQL)
>>
>> ...
>>
>> Set objRS = objConn.Execute(strSQL2)
>> ...
>>
>> Set objRS = objConn.Execute(strSQL3)
>> ...
>>
>> Set objRS = objConn.Execute(strSQL4)
>>
>> ...
>>
>> Set objRS = Nothing
>>
>> ' SCENARIO 2
>> Set objRS = objConn.Execute(strSQL)
>>
>> ...
>>
>> Set objRS = Nothing
>> Set objRS = objConn.Execute(strSQL2)
>> ...
>>
>> Set objRS = Nothing
>> Set objRS = objConn.Execute(strSQL3)
>> ...
>>
>> Set objRS = Nothing
>> Set objRS = objConn.Execute(strSQL4)
>>
>> ...
>>
>> Set objRS = Nothing

>
>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resource expression to access resource located in library Heinrich Moser ASP .Net 1 03-27-2008 04:25 PM
Very annoying error: Access to the path is denied. ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity Jay ASP .Net 2 08-20-2007 07:38 PM
Resource manager problem: naming for embedded resource. Dirc Khan-Evans ASP .Net 1 10-17-2005 12:52 PM
Error Message - No permission to use this network resource - =?Utf-8?B?UGV0ZXI=?= Wireless Networking 3 12-13-2004 04:37 PM
The system cannot locate the resource specified. Error processing resource avishosh XML 2 08-08-2004 06:28 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57