Ask a Question related to ASP Database, Design and Development.
-
Laphan #1
Whats my RecordSet doing?
Hi All
I'd just like to confirm something with you if you don't mind.
Basically when my ASP page contains 3 or 4 queries, in my own little world I
thought I was conserving resources by reusing the main ADODB objects of
Connection, Command and Recordset rather than continually creating,
dropping, creating, etc An example is as follows:
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Connectionstring = strDSN
oConn.Open
Set oCmd=Server.CreateObject("ADODB.Command")
Set oCmd.ActiveConnection = oConn
oCmd.CommandText = "PostOrder(" & myorderparams & ")"
oCmd.CommandType = 4
oCmd.Execute
oCmd.CommandText = "GetOrderNo()"
oCmd.CommandType = 4
Set oRSv=Server.CreateObject("ADODB.recordset")
oRSv.open oCmd
IF NOT oRSv.EOF THEN
strOrderNo = oRSv("ORDERNO")
END IF
oRSv.close
oCmd.CommandText = "ShowReport()"
oCmd.CommandType = 4
oRSv.open oCmd
IF NOT oRSv.EOF THEN
strOrderNo = oRSv("ORDERNO")
END IF
oRSv.close
Set oRSv=nothing
Set oCmd=nothing
oConn.close
Set oConn=nothing
Now the same 1 Command object seems to be reusable, but am I actually only
using 1 Recordset object or is it that when I 'oRSv.close' and then
'oRSv.open oCmd' I'm actually completely closing and recreating a oRSv
Recordset each time?
I'm not actually setting the oRSv to nothing until the end, but if I don't
use the '.close' option then I can't reuse my oRSv recordset for another
job.
I just want to be resourceful as possible on this aspect and my decision was
that if the above is in fact dropping and re-creating a recordset each time,
I would create my Command and Recordset objects at the beginning of my page
(in an include file), do the required jobs and then have a closing objects
include file at the end of the page.
Thanks
Laphan
Laphan Guest
-
Whats the problem with my SQL???
I'm having problem with my SQL Statement, can anyone help me? Here's the error: Error Type: ADODB.Recordset (0x800A0E7D) The connection cannot be... -
Whats the best way ??
I have just purchased Contribute to allow our marketing department to add content to our web site. Up until now I've had a local copy on my C drive... -
RecordSet.Move or RecordSet.AbsolutePosition??
Hi, I'm trying to use either one of these methods to position the cursor in a specific position inside a recordset, but neither one seems to... -
whats the best way to?
write one function (for navigation) and call it in multiple asp.net pages? - i would use an include file as i do in asp but i gather this isnt the... -
Whats Is Fast For Setting Recordset !
Dear Friends Hope you all doing great. Few days ago I asked you all for a coment on using Access and ASP. I got many replies. In one of the... -
Bob Barrows #2
Re: Whats my RecordSet doing?
Laphan wrote:
What has made you doubt this?> Hi All
>
> I'd just like to confirm something with you if you don't mind.
>
> Basically when my ASP page contains 3 or 4 queries, in my own little
> world I thought I was conserving resources by reusing the main ADODB
> objects of Connection, Command and Recordset rather than continually
> creating, dropping, creating, etc
What difference does it make? Yes, you are closing and re-opening it with a> Now the same 1 Command object seems to be reusable, but am I actually
> only using 1 Recordset object or is it that when I 'oRSv.close' and
> then 'oRSv.open oCmd' I'm actually completely closing and recreating
> a oRSv Recordset each time?
different source.
This is true.>
> I'm not actually setting the oRSv to nothing until the end, but if I
> don't use the '.close' option then I can't reuse my oRSv recordset
> for another job.
There's no dropping done when the recordset is closed. The recordet's>
> I just want to be resourceful as possible on this aspect and my
> decision was that if the above is in fact dropping
properties and Fields collection are reset, but you still have a recordset
object in memory.
No, you are not recreating it when you use .Open. You are resetting its> and re-creating a
> recordset each time,
properties and Fields collection to the new values provided by the new data
source.
As I said in my last reply, this is my preferred way of doing it. I only use> I would create my Command and Recordset objects
> at the beginning of my page (in an include file), do the required
> jobs and then have a closing objects include file at the end of the
> page.
>
multiple recordset variables when I need to have two recordsets opened
simultaneously, which is rare.
Time to move on. Stop obsessing about this.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest
-
Astra #3
Re: Whats my RecordSet doing?
Thanks for the therapy session Bob.
Much appreciated.
Rgds
Robbie
"Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
news:OTTSVPtKEHA.1280@TK2MSFTNGP10.phx.gbl...
Laphan wrote:What has made you doubt this?> Hi All
>
> I'd just like to confirm something with you if you don't mind.
>
> Basically when my ASP page contains 3 or 4 queries, in my own little
> world I thought I was conserving resources by reusing the main ADODB
> objects of Connection, Command and Recordset rather than continually
> creating, dropping, creating, etc
What difference does it make? Yes, you are closing and re-opening it with a> Now the same 1 Command object seems to be reusable, but am I actually
> only using 1 Recordset object or is it that when I 'oRSv.close' and
> then 'oRSv.open oCmd' I'm actually completely closing and recreating
> a oRSv Recordset each time?
different source.
This is true.>
> I'm not actually setting the oRSv to nothing until the end, but if I
> don't use the '.close' option then I can't reuse my oRSv recordset
> for another job.
There's no dropping done when the recordset is closed. The recordet's>
> I just want to be resourceful as possible on this aspect and my
> decision was that if the above is in fact dropping
properties and Fields collection are reset, but you still have a recordset
object in memory.
No, you are not recreating it when you use .Open. You are resetting its> and re-creating a
> recordset each time,
properties and Fields collection to the new values provided by the new data
source.
As I said in my last reply, this is my preferred way of doing it. I only use> I would create my Command and Recordset objects
> at the beginning of my page (in an include file), do the required
> jobs and then have a closing objects include file at the end of the
> page.
>
multiple recordset variables when I need to have two recordsets opened
simultaneously, which is rare.
Time to move on. Stop obsessing about this.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Astra Guest



Reply With Quote

